Skip to content

Commit a501a0a

Browse files
author
strausr
committed
fix: use npm 11+ in publish step for OIDC trusted publishing
OIDC for npm publish requires npm CLI 11.5.1+; Node 20 ships with npm 9.x. Upgrade to npm@latest before publish so trusted publishing works.
1 parent d451a40 commit a501a0a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ jobs:
141141
# npm publish uses OIDC (id-token: write + --provenance). No NPM_TOKEN needed.
142142
# Require on npmjs.com: Package → Package settings → Trusted publishers →
143143
# Add: GitHub Actions, org cloudinary-devs, repo create-cloudinary-react, workflow release.yml
144+
# npm trusted publishing (OIDC) requires npm CLI 11.5.1+; Node 20 ships with npm 9.x.
144145
# Force OIDC-only: override NPM_CONFIG_USERCONFIG so npm ignores setup-node's .npmrc (which may reference a stale token).
145146
- name: Publish to npm using trusted publishing
146147
if: github.event.inputs.dry_run != 'true'
@@ -153,6 +154,9 @@ jobs:
153154
unset NODE_AUTH_TOKEN NPM_TOKEN 2>/dev/null || true
154155
# Config that has only registry — no _authToken — so npm uses OIDC
155156
echo "registry=https://registry.npmjs.org/" > "$NPM_CONFIG_USERCONFIG"
157+
# OIDC for publish requires npm 11.5.1+ (Node 20 ships with npm 9.x)
158+
npm install -g npm@latest
159+
npm --version
156160
157161
# Get versions
158162
VERSION_BEFORE="${{ steps.version-before.outputs.version }}"

0 commit comments

Comments
 (0)