chore: use changesets #3
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| env: | |
| CI: true | |
| permissions: | |
| contents: write # to create release (changesets/action) | |
| id-token: write # required for provenance and OIDC publish | |
| pull-requests: write # to create pull request (changesets/action) | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v5 | |
| with: | |
| version: latest | |
| - uses: actions/setup-node@v6 | |
| with: | |
| cache: pnpm | |
| node-version: 24 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm build | |
| - name: Lint | |
| run: |- | |
| pnpm eslint src "*.js" "*.ts" | |
| pnpm prettier --check src "*.js" "*.ts" | |
| - name: Install Playwright | |
| if: github.event_name == 'pull_request' | |
| run: npx playwright install --with-deps | |
| - name: Run tests (Chrome) | |
| if: github.event_name == 'pull_request' | |
| run: pnpm test --browser chromium | |
| - name: Run tests (Firefox) | |
| if: github.event_name == 'pull_request' | |
| run: pnpm test --browser firefox | |
| - name: Run tests (WebKit) | |
| if: github.event_name == 'pull_request' | |
| run: pnpm test --browser webkit | |
| # Temporary until setup-node action comes with npm version that contains | |
| # OIDC setup by default | |
| - name: Update npm | |
| if: github.repository == 'birchill/jpdict-idb' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| run: npm update -g npm | |
| - name: Create/update pull request or publish | |
| if: github.repository == 'birchill/jpdict-idb' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: changesets/action@v1 | |
| with: | |
| commit: 'chore(release): publish' | |
| title: 'Publish next version' | |
| publish: pnpm ci:publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |