Publish #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to publish (e.g., 0.1.1, 0.2.0, 1.0.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| publish: | |
| name: Publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 25 | |
| check-latest: true | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm i | |
| - name: Biome | |
| run: node --run biome:ci | |
| - name: Typecheck | |
| run: node --run typecheck | |
| - name: ESLint | |
| run: node --run eslint | |
| - name: Prettier | |
| run: node --run prettier:check | |
| - name: Bundle | |
| run: node --run build | |
| - name: Build website | |
| run: node --run build:website | |
| - name: Install Playwright Browsers | |
| run: npx playwright install chromium firefox | |
| - name: Test | |
| run: node --run test | |
| timeout-minutes: 4 | |
| - name: Visual regression test | |
| run: node --run visual | |
| - name: Update version | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | |
| npm version ${{ inputs.version }} | |
| # https://docs.npmjs.com/trusted-publishers | |
| - name: Publish to npm | |
| run: npm publish --tag latest | |
| - name: Push tag | |
| run: git push origin v${{ inputs.version }} | |
| - name: Create GitHub Release | |
| run: gh release create v${{ inputs.version }} --title "v${{ inputs.version }}" --generate-notes | |
| env: | |
| GH_TOKEN: ${{ github.token }} |