Skip to content

Commit 8911488

Browse files
committed
fix(ci): Upgrade npm before publish to enable OIDC trusted-publisher path
Node 22 (the setup-node version this workflow pins) ships with npm 10.x. npm 10 can SIGN provenance via OIDC (the --provenance flag works) but the actual PUT to publish still authenticates with NODE_AUTH_TOKEN. With a configured Trusted Publisher on npmjs.com and no NPM_TOKEN secret provided, the publish PUT runs with an empty token and npm responds `404 Not Found - PUT ...` -- which is the exact failure mode the v0.9.0 release just hit (publish provenance succeeded, then PUT failed). Token-less OIDC publish via Trusted Publisher was added in npm 11.5.1. Add a step that upgrades the global npm to latest before `npm publish` so the publish step picks up the OIDC-aware code path. The Node major (22) is intentionally pinned; only npm itself is bumped.
1 parent d315e0d commit 8911488

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ jobs:
104104
env:
105105
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106106

107+
- name: Upgrade npm to a version that supports OIDC publishing
108+
# Node 22 ships with npm 10.x. npm 10 can sign provenance via OIDC
109+
# but still requires NODE_AUTH_TOKEN to actually publish, so a
110+
# workflow with a configured Trusted Publisher (and no NPM_TOKEN
111+
# secret) errors with `404 Not Found` on the PUT. Token-less
112+
# OIDC publish via Trusted Publisher requires npm >= 11.5.1.
113+
run: |
114+
npm install -g npm@latest
115+
npm --version
116+
107117
- name: Publish to npm
108118
working-directory: packages/npm
109119
run: npm publish --access public --provenance

0 commit comments

Comments
 (0)