Publish to npm #9
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 | |
| # Trusted publishing (OIDC) with provenance — no npm token needed. | |
| # Configure the trusted publisher on npm first: | |
| # npmjs.com → package/account settings → Trusted Publisher | |
| # Repository: KayhanB21/queue-economics Workflow: publish.yml | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write # required for OIDC trusted publishing + provenance | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| # Deployment protection: requires the "release" GitHub environment (add | |
| # required reviewers there). The npm trusted publisher must also set its | |
| # "Environment name" field to "release" so the OIDC claim matches. | |
| environment: release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: "https://registry.npmjs.org" | |
| # Trusted publishing requires npm >= 11.5.1. | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Test | |
| run: bun test | |
| - name: Build | |
| run: bun run build | |
| - name: Publish (provenance via OIDC) | |
| run: npm publish --provenance --access public |