Skip to content

fix(ci): install an npm new enough for trusted publishing - #21

Merged
vilenarios merged 1 commit into
mainfrom
ci/npm-version-for-trusted-publishing
Aug 28, 2026
Merged

fix(ci): install an npm new enough for trusted publishing#21
vilenarios merged 1 commit into
mainfrom
ci/npm-version-for-trusted-publishing

Conversation

@vilenarios

Copy link
Copy Markdown
Contributor

The 1.0.2 release now gets all the way to the publish and fails there:

npm notice version: 1.0.2
npm error code ENEEDAUTH
npm error need auth This command requires you to be logged in to https://registry.npmjs.org/

Cause

@semantic-release/npm does not publish with the OIDC token itself — it only confirms the exchange is possible, then deliberately writes no auth to .npmrc and lets npm publish handle it:

if (await oidcContextEstablished(registry, pkg, context)) return
await setNpmrcAuth(npmrc, registry, context)

npm gained trusted-publishing support in 11.5.1. The runner resolves node-version: 22 to 22.23.2, which bundles npm 10.x — so npm publish runs with no credentials at all.

Fix

Install npm ^11.5.1 before the release step, and print the version so this is visible in the log.

Note

The trusted publisher on npmjs.com is already correct. The registry only mints an exchange token for a matching repo + workflow, and the log shows:

OIDC token exchange with the npm registry succeeded

So this is the last piece — no npmjs.com change needed.

Related: the stale fix/release-disable-oidc branch (off the 1.0.1 release commit) hit this same wall and worked around it by abandoning OIDC. This fixes it instead, keeping trusted publishing and the provenance attestation that comes with it. That branch can be deleted.

npm performs the OIDC exchange itself and only gained that support in
11.5.1; Node 22 bundles npm 10.x, so npm publish ran unauthenticated and
failed with ENEEDAUTH while the plugin reported the exchange succeeding.
@vilenarios
vilenarios merged commit 465ada6 into main Aug 28, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@vilenarios
vilenarios deleted the ci/npm-version-for-trusted-publishing branch August 28, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant