Merge pull request #86 from dopry/chore/npm-trusted-publisher #39
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: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| push: | |
| branches: | |
| - main | |
| - next | |
| - '+([0-9])?(.{+([0-9]),x}).x' | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint-test-build-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| # Ensure npm 11.5.1 or later is installed for npm trusted publishing | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint code | |
| run: npm run lint | |
| # Disabled until tests are implemented | |
| # name: Unit Tests | |
| # run: npm run test:unit | |
| - name: Build | |
| run: npm run build | |
| # this is not needed when using the playwright container; it has browsers pre-installed | |
| # - name: playwright install, required for e2e tests | |
| # run: npx playwright install chromium --with-deps | |
| - name: E2E Tests | |
| uses: docker://mcr.microsoft.com/playwright:v1.56.1-noble | |
| with: | |
| args: npm run test:e2e | |
| # release does a second build due to the prepublishOnly script. | |
| # that's okay we want that to happen to prevent publishing stale local builds. | |
| # if performance becomes an issue, we can look into preventing the double build. | |
| - name: Release | |
| if: github.event_name == 'push' | |
| run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |