Skip to content

3.0.0

3.0.0 #25

Workflow file for this run

name: Lint, Test, Publish and Release
permissions:
checks: write
contents: write
on:
push:
tags:
- 'v*'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run linter
id: lint
run: pnpm lint || pnpm lint:fix
- name: Commit lint fixes
if: steps.lint.outcome == 'failure'
run: |
if [[ -n $(git status --porcelain) ]]; then
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "chore: fix lint errors"
git push
fi
test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run prepare
run: pnpm dev:prepare
- name: Cache build outputs
uses: actions/cache@v4
with:
path: |
.nuxt
dist
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-
- name: Run tests
run: pnpm test
- name: Run type checks
run: pnpm test:types
build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run dev:prepare
run: pnpm dev:prepare
- name: Run prepack (build module)
run: pnpm prepack
- name: Build playground
run: pnpm build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist/
.nuxt/
playground/.output/
retention-days: 1
publish:
runs-on: ubuntu-latest
needs: [lint, test, build]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run dev:prepare
run: pnpm dev:prepare
- name: Publish to npm
shell: bash
if: success()
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
if: success()
run: npx --yes changelogithub@latest
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}