Publish to npm #26
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 to npm | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: # manual publish of the current package.json version on the selected ref | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: npm | |
| permissions: | |
| contents: read | |
| id-token: write # Required for OIDC trusted publishing | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://registry.npmjs.org" | |
| # OIDC provenance needs a recent npm. Pinned to npm@11 (not @latest): npm@12 | |
| # ships a broken provenance path that can't resolve its `sigstore` dependency. | |
| # npm@11 is what published every release through 0.13.0. | |
| - name: Upgrade npm for OIDC support | |
| run: npm install -g npm@11 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Run tests | |
| run: pnpm test:unit | |
| - name: Verify build artifacts | |
| run: | | |
| test -f dist/index.js | |
| test -f dist/index.cjs | |
| test -f dist/index.d.ts | |
| - name: Publish to npm | |
| run: pnpm publish --no-git-checks --access public |