Skip to content

Commit 70d4592

Browse files
committed
ci: migrate to npm OIDC trusted publishing
- Add explicit permissions (contents: write, id-token: write) to npm-publish job - Upgrade npm to latest for OIDC support (requires npm 11.5.1+) - Use --provenance flag for supply chain security - Remove NODE_AUTH_TOKEN - OIDC handles authentication Ref: https://github.blog/changelog/2025-12-09-npm-classic-tokens-revoked-session-based-auth-and-cli-token-management-now-available/
1 parent edf8eb8 commit 70d4592

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/cd.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
npm-publish:
4545
runs-on: ubuntu-22.04
4646
needs: test
47+
permissions:
48+
contents: write # for git tag push
49+
id-token: write # for npm OIDC trusted publishing
4750
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/publish'
4851
steps:
4952
- name: Checkout
@@ -57,6 +60,8 @@ jobs:
5760
with:
5861
node-version: "20"
5962
registry-url: "https://registry.npmjs.org"
63+
- name: Upgrade npm for OIDC support
64+
run: npm install -g npm@latest
6065
- run: bun install
6166
- name: Bump Version
6267
id: bump
@@ -65,10 +70,8 @@ jobs:
6570
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6671
- name: Build
6772
run: bun run build
68-
- name: Publish to npm
69-
run: npm publish
70-
env:
71-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
73+
- name: Publish to npm with provenance
74+
run: npm publish --provenance --access public
7275
- name: Create git tag
7376
run: |
7477
git config --local user.email "github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)