Skip to content

Commit 4d56607

Browse files
committed
ci(npm): switch to OIDC trusted publishing (drop NPM_TOKEN)
Use npm trusted publishing via GitHub OIDC instead of a stored NPM_TOKEN: add id-token: write, upgrade npm to >= 11.5.1, remove NODE_AUTH_TOKEN. Eliminates the long-lived token (which had expired) and its rotation/leak risk. Requires the matching trusted publisher configured on npmjs.com for this repo + workflow (publish-npm.yml).
1 parent 30a1cdf commit 4d56607

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
tags:
77
- "v*"
88

9+
permissions:
10+
contents: read
11+
id-token: write # OIDC: required for npm trusted publishing (no stored token)
12+
913
jobs:
1014
publish:
1115
runs-on: ubuntu-latest
@@ -14,10 +18,13 @@ jobs:
1418

1519
- uses: actions/setup-node@v4
1620
with:
17-
node-version: "18"
21+
node-version: "22"
1822
registry-url: 'https://registry.npmjs.org'
1923

24+
# Trusted publishing needs npm >= 11.5.1; Node 22 ships an older npm.
25+
- name: Upgrade npm
26+
run: npm install -g npm@latest
27+
28+
# OIDC trusted publishing — no NODE_AUTH_TOKEN. Provenance is automatic.
2029
- name: Publish to npm
2130
run: npm publish
22-
env:
23-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)