Skip to content

ci: force the OIDC-capable @semantic-release/npm so trusted publishing works - #8

Merged
murdore merged 1 commit into
releasefrom
fix/semantic-release-oidc-plugin
Aug 10, 2026
Merged

ci: force the OIDC-capable @semantic-release/npm so trusted publishing works#8
murdore merged 1 commit into
releasefrom
fix/semantic-release-oidc-plugin

Conversation

@murdore

@murdore murdore commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

After the Node/npm fix in #7, the release run got all the way through install, lint, build and test, reached semantic-release — and failed with:

✘  EINVALIDNPMTOKEN Invalid npm token.

That looks like "trusted publisher not configured yet", but it is not. The wrong plugin was running. The stack trace gives it away:

node_modules/.pnpm/@semantic-release+npm@12.0.2_semantic-release@24.2.9/

Cause

semantic-release resolves plugins from its own directory first. Under pnpm's isolated layout that means it loads the copy it depends on — 12.0.2 — not the 13.1.5 sitting in devDependencies.

@semantic-release/npm@12.0.2 predates trusted publishing entirely. It has no lib/trusted-publishing/, so verifyConditions demands NPM_TOKEN unconditionally and OIDC can never engage. Confirmed by grepping both copies:

version lib/trusted-publishing/oidc-context.js
12.0.2 (what CI loaded) absent
13.1.5 (devDependency, unused) present

So configuring the trusted publisher alone would not have fixed the release.

Fix — what neurolink actually does

Three things, not one. I had only the middle one:

neurolink workforge before after
semantic-release ^25.0.3 (bundles plugin 13.x) ^24.2.8 (bundles 12.x) ^25.0.9
@semantic-release/npm ^13.1.4 ^13.1.2 ^13.1.4
pnpm.overrides["@semantic-release/npm"] ^13.1.4 ❌ absent ^13.1.4

The override is the load-bearing part — it forces 13.x inside semantic-release, where the resolution actually happens.

Verified

  • semantic-release@25.0.9 resolves @semantic-release/npm@13.1.5 from its own node_modules, and that copy has lib/trusted-publishing/oidc-context.js
  • No 12.x copy remains in the pnpm store or the lockfile
  • semantic-release config still loads on v25 (all plugins, release correctly identified as the only publishing branch)
  • The 10 dependency advisories stay patched
  • Build, lint (0 errors), all 53 tests pass

Why ci:

Non-releasing type — the trusted publisher still is not configured, so a releasing commit would fail at publish. This lets the pipeline run green as a no-op.

…g works

After the Node/npm fix, the release run reached semantic-release and then
failed with:

  ✘  EINVALIDNPMTOKEN Invalid npm token.

Not a missing trusted publisher — the wrong plugin was running. The stack
trace pointed at:

  node_modules/.pnpm/@semantic-release+npm@12.0.2_semantic-release@24.2.9/

semantic-release resolves plugins from its own directory first, so under
pnpm's isolated layout it loaded the copy it depends on (12.0.2) rather than
the 13.1.5 in devDependencies. 12.0.2 predates trusted publishing entirely —
it has no lib/trusted-publishing/, so verifyConditions demands NPM_TOKEN
unconditionally and OIDC can never engage.

Mirrors what neurolink actually does, which is three things, not one:

  semantic-release            ^25.0.3   (bundles @semantic-release/npm ^13.1.1)
  @semantic-release/npm       ^13.1.4
  pnpm.overrides
    @semantic-release/npm     ^13.1.4   <- forces it inside semantic-release

Only the direct devDependency was present here; without the override and on
semantic-release 24, the 12.x copy won.

Verified after the change: semantic-release@25.0.9 resolves
@semantic-release/npm@13.1.5 from its own node_modules, that copy has
lib/trusted-publishing/oidc-context.js, and no 12.x copy remains in the store
or the lockfile. Config still loads on v25, the dependency advisories stay
clear, and build, lint and all 53 tests pass.

Typed `ci:` so it does not trigger a release before the trusted publisher is
configured.
@murdore
murdore merged commit 1986713 into release Aug 10, 2026
6 checks passed
@murdore
murdore deleted the fix/semantic-release-oidc-plugin branch August 10, 2026 10:12
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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