ci: upgrade to npm 11 before install #207
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: Tests | |
| on: | |
| push: | |
| pull_request: | |
| types: [opened, reopened] | |
| branches: [main] | |
| release: | |
| types: [published] | |
| jobs: | |
| run-tests: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-latest | |
| - windows-latest | |
| - ubuntu-22.04 | |
| node: | |
| - 20 | |
| - 22 | |
| - 24 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| # npm 10 (bundled with Node 20/22) crashes resolving tsdown's optional | |
| # `@vitejs/devtools: *` peer with "Cannot read properties of null | |
| # (reading 'edgesOut')". npm 11 handles it, so upgrade before installing. | |
| - run: npm install -g npm@11 | |
| - run: npm install | |
| - run: npm test | |
| - run: npm run build | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: run-tests | |
| if: github.event_name == 'release' | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| # See the note in run-tests: npm 10 crashes on tsdown's optional peer. | |
| - run: npm install -g npm@11 | |
| - run: npm install | |
| - run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |