fix(ci): use npm trusted publishing via OIDC on Node 24#842
Merged
m-abdelwahab merged 1 commit intomasterfrom Apr 13, 2026
Merged
fix(ci): use npm trusted publishing via OIDC on Node 24#842m-abdelwahab merged 1 commit intomasterfrom
m-abdelwahab merged 1 commit intomasterfrom
Conversation
The Publish NPM job has been failing since v4.37.0. Root cause: npm 10 (bundled with Node 22) can sign provenance via OIDC but cannot authenticate the registry upload itself via trusted publishing — that requires npm >= 11.5.1. With no NODE_AUTH_TOKEN secret configured, the publish fell through to an anonymous PUT, which the registry rejected as a 404 (the standard response for scoped packages when auth is missing). Bump the runner to Node 24, which bundles npm 11.x. Drop --provenance since trusted publishing attaches it automatically. Also bump actions/setup-node to v6 — v4 runs on Node 20 internally, which GitHub is deprecating. This supersedes #838, which removed the npm self-upgrade step after npm@latest started cross-major upgrading and corrupting itself mid-install. Using Node 24's bundled npm avoids both the corruption and the self-upgrade entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aec9eec to
6b77c26
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
Publish NPMjob, which has been silently failing since v4.37.0. npm is currently stuck on 4.36.1 while GitHub releases and crates.io have shipped 4.37.0 → 4.37.2.--provenance(automatic under trusted publishing)actions/setup-nodev4 → v6 (v4 runs on Node 20 internally, which GitHub is deprecating)Root cause
The last three releases failed on the same
npm publishstep with a misleading error:The package is in the registry — the 404 is what npm returns for a scoped package when auth is missing. Trusted publishing is configured on npmjs.com correctly, but npm 10 (bundled with Node 22) doesn't support trusted publishing for registry auth:
--provenance)That's why the failed log shows
Signed provenance statement...succeeding (OIDC → Sigstore worked) immediately before the 404 on the actual upload (no OIDC → registry). With noNODE_AUTH_TOKENsecret in the repo, npm fell through to an anonymous PUT.Failing run: https://github.com/railwayapp/cli/actions/runs/24256202033/job/70829420403
Why Node 24, not an
npm install -gstep#838 removed
npm install -g npm@latestafter it started cross-major-upgrading npm 10 → 11 on the runner and corrupting itself mid-install (npm removes its ownnode_modulesdependencies likepromise-retrywhile replacing them). The PR description there claimed Node 22 + npm 10 was sufficient because "npm has had OIDC/provenance support since 9.5.0" — but that conflated provenance signing (npm ≥ 9.5.0) with trusted publishing auth (npm ≥ 11.5.1).Node 24 LTS bundles npm 11.x directly, so no self-upgrade is needed — avoiding both the auth issue and the corruption risk #838 was working around.
What about
--provenance?Trusted publishing attaches provenance attestations automatically, so the flag is redundant. Leaving it in would work but is noise.
Release strategy
This PR ships with
release/skip— it's a CI-only change with no user-facing code impact, so it doesn't warrant its own version bump. The trusted-publishing flow will be validated by the next real patch/feature PR that carries arelease/patchlabel. When that PR cuts v4.37.3, the release will:npm will jump from
4.36.1→4.37.3, skipping the stranded4.37.0–4.37.2tags on npm. That's safe: nothing on npm pins those versions (they were never published there),npm install -g @railway/clialways resolves to@latest, and the feature content accumulated in those tags will all land on npm when 4.37.3 publishes.Test plan
release/skip)release/patchlabelPublish NPMjob succeedsnpm view @railway/cli@4.37.3showsdist.attestationspopulated (provenance attached automatically via trusted publishing)npm install -g @railway/cliinstalls 4.37.3 and runsReferences
🤖 Generated with Claude Code