Skip to content

Commit f30df95

Browse files
committed
ci: switch npm publish to trusted publishing (OIDC), drop NPM_TOKEN
Configure publish-npm.yml as the package's trusted publisher on npmjs.com; the job's OIDC identity (id-token: write) replaces any token secret, and provenance is attached automatically. Node 24 already bundles npm 11 which supports this.
1 parent 2df27c4 commit f30df95

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ jobs:
3939
- run: npm test
4040
- run: npm pack --dry-run
4141

42-
- name: Publish (idempotent, with provenance)
42+
- name: Publish (trusted publishing, idempotent)
43+
# Tokenless: configure this workflow as the package's trusted publisher
44+
# on npmjs.com; npm exchanges the job's OIDC identity (id-token: write)
45+
# for short-lived credentials. Provenance is attached automatically.
46+
# Requires npm >= 11.5.1 (Node 24 bundles npm 11).
4347
run: |
4448
set -euo pipefail
4549
name=$(node -p "require('./package.json').name")
@@ -49,7 +53,5 @@ jobs:
4953
if npm view "${name}@${version}" version >/dev/null 2>&1; then
5054
echo "${name}@${version} already published — skipping"
5155
else
52-
npm publish --provenance
56+
npm publish
5357
fi
54-
env:
55-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)