fix: npm publish doesn't understand workspace:*
#745
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: Test & Release | |
| on: [push, pull_request] | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| tests: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node: [ '18', '20' ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - run: pnpm install | |
| - run: pnpm build | |
| - run: pnpm test:packages | |
| - run: pnpm lint | |
| - run: pnpm lint:attw | |
| - run: pnpm lint:publint | |
| # Catches `workspace:`-style ranges that would ship to the registry | |
| # uninstallable. publint and attw both pass such a manifest. | |
| - run: pnpm lint:manifests | |
| release: | |
| name: Release | |
| if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'beta') }} | |
| needs: tests | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.14.0' | |
| # @semantic-release/npm bundles its own `npm` dependency, but under pnpm's | |
| # dependency isolation that copy isn't reachable via execa's `preferLocal` from | |
| # other packages - it falls back to whatever `npm` is on PATH. That needs to be | |
| # recent enough to support Trusted Publishers (OIDC), hence installing it here | |
| # explicitly rather than relying on whatever Node bundles. | |
| - run: npm install -g npm@11 | |
| - run: pnpm install | |
| - run: pnpm release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |