Skip to content

Commit 4b8e5eb

Browse files
author
sergey-ermakovich
committed
Fix the npm job so OIDC trusted publishing actually runs
Node 22 ships npm 10.9.8, which predates OIDC publishing (added in npm 11.5.1), so the job could not authenticate whatever the registry was configured with. Moves to Node 24, upgrades npm explicitly, and drops registry-url because setup-node was writing an .npmrc with a placeholder auth token that npm preferred over OIDC.
1 parent d80fe5b commit 4b8e5eb

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,20 @@ jobs:
3333
runs-on: ubuntu-latest
3434
steps:
3535
- uses: actions/checkout@v4
36+
# No registry-url here on purpose. With it, setup-node writes an .npmrc
37+
# carrying _authToken=${NODE_AUTH_TOKEN}, which resolves to a placeholder
38+
# when no token is passed. npm then authenticates with that garbage instead
39+
# of falling back to OIDC, and a scoped package answers 404.
3640
- uses: actions/setup-node@v4
3741
with:
38-
node-version: '22'
39-
registry-url: 'https://registry.npmjs.org'
42+
node-version: '24'
43+
# OIDC trusted publishing landed in npm 11.5.1. Node 24 already ships a
44+
# newer npm than that, but pinning the upgrade here keeps the job working
45+
# if the runner image drifts back.
46+
- name: Upgrade npm for OIDC trusted publishing
47+
run: |
48+
npm install -g npm@latest
49+
npm -v
4050
- name: Set version from the tag
4151
run: npm version "${GITHUB_REF_NAME#v}" --no-git-tag-version --allow-same-version
4252
- name: Publish to npm (OIDC, no token)

0 commit comments

Comments
 (0)