Skip to content

fix(ci): publish with the npm CLI so OIDC trusted publishing works - #4

Merged
darkobas2 merged 1 commit into
mainfrom
fix/publish-with-npm-cli
Aug 18, 2026
Merged

fix(ci): publish with the npm CLI so OIDC trusted publishing works#4
darkobas2 merged 1 commit into
mainfrom
fix/publish-with-npm-cli

Conversation

@darkobas2

Copy link
Copy Markdown
Contributor

The 0.1.0 publish failed with 404 Not Found - PUT even though the trusted publisher record is correct (ethersphere/core-sdk / publish_npmjs.yml / environment publish) and provenance signing succeeded:

npm notice publish Signed provenance statement with source and build information from GitHub Actions
npm error 404 Not Found - PUT https://registry.npmjs.org/@ethersphere%2fcore-sdk

Cause

From the failed run's env:

NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX

setup-node's registry-url always writes an .npmrc containing //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}. With no token supplied, NODE_AUTH_TOKEN is that literal placeholder. npm ≥ 11.5.1 detects OIDC is available and overrides the placeholder with a real trusted-publishing token. pnpm 10.29.2 sent the placeholder verbatim, and the registry answers 404 on PUT rather than 401/403 so it doesn't leak whether a package exists.

So this was never a permissions problem — it was an unauthenticated request wearing a placeholder token, and the 404 made it look like the package was missing.

For the record this is not pnpm/pnpm#11513 (OIDC broken in pnpm 11) — that regression landed in 11.0.8 and this run used 10.29.2.

Fix

npm publish instead of pnpm publish, and node 24 instead of 22 — node 24 is what pins npm to 11.x. This is exactly how swarm-cli publishes, which has five consecutive successful releases on it. pnpm still does install and build; only the publish call changes.

After merge

main is already at 0.1.0 and the core-sdk-v0.1.0 release exists, but npm only has 0.0.1. This fix: commit will have release-please open a 0.1.1 release PR — merging that cuts a release and gives the workflow a genuine end-to-end run. npm will end up with 0.0.1 and 0.1.1, skipping 0.1.0, which is a cosmetic gap in exchange for not hand-rolling tags.

The 0.1.0 publish failed with `404 Not Found - PUT` even though the npm
trusted publisher record (ethersphere/core-sdk, publish_npmjs.yml,
environment publish) is correct and provenance signing succeeded.

Cause is in the runner env, visible in the failed run's log:

  NPM_CONFIG_USERCONFIG: /home/runner/work/_temp/.npmrc
  NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX

setup-node's `registry-url` always writes an .npmrc containing
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}. With no token
supplied, NODE_AUTH_TOKEN is that literal placeholder. npm >= 11.5.1
detects that OIDC is available and replaces it with a real
trusted-publishing token; pnpm 10.29.2 sent the placeholder verbatim, and
the registry answers 404 on PUT rather than 401/403 so as not to leak
whether a package exists.

So this was never a permissions problem -- it was an unauthenticated
request wearing a placeholder token.

Switches the publish step to `npm publish` and bumps the job to node 24,
which is what pins npm to 11.x. That is exactly how swarm-cli publishes.
pnpm still handles install and build; only the publish call changes.

Note this is NOT pnpm/pnpm#11513 (OIDC broken in pnpm 11) -- that
regression is in 11.0.8 and this ran 10.29.2.
@darkobas2
darkobas2 merged commit 9084e30 into main Aug 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant