Skip to content

ci: pin npm to 11.x and skip an already-published crates.io version - #38

Merged
MichaelTaylor3d merged 1 commit into
mainfrom
fix/npm-publish-engine
Aug 27, 2026
Merged

ci: pin npm to 11.x and skip an already-published crates.io version#38
MichaelTaylor3d merged 1 commit into
mainfrom
fix/npm-publish-engine

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

Fixes the npm half of the 5.0.0 release, which failed on EBADENGINE while crates.io succeeded.

npm install -g npm@latest now resolves npm 12, which requires Node ^22.22.2; this job sets up Node 20. An unpinned global upgrade breaks the moment upstream raises its engine floor. Pinned to npm@11 — 11.6.2 declares ^20.17.0 || >=22.9.0, and trusted publishing needs only >= 11.5.1.

Also guards the crates.io step against a version already on the index, because the two registries have now diverged (5.0.0 live on crates.io, absent from npm) and the only retry path is another release commit — which would otherwise go red on already uploaded and bury the npm result. The guard's User-Agent header is required; without it crates.io answers in a way that reads exactly like "not published", inverting the guard into always-publish. Control-tested against the live index: 5.0.0 matches, a bogus 9.9.9 does not.

This commit's subject is deliberately not a bare semver, so merging it publishes nothing. Refs #37.

The 5.0.0 release published to crates.io and FAILED on npm. Cause was not the
release trigger: `npm install -g npm@latest` started resolving npm 12, which
requires Node ^22.22.2, while this job sets up Node 20.

  npm error code EBADENGINE
  npm error Required: {"node":"^22.22.2 || ^24.15.0 || >=26.0.0"}
  npm error Actual:   {"npm":"10.8.2","node":"v20.20.2"}

An unpinned global upgrade breaks the moment upstream raises its engine floor,
and it took the npm half of a release with it. Pinned to npm@11: 11.6.2
declares ^20.17.0 || >=22.9.0, so it satisfies this runner, and trusted
publishing needs only >= 11.5.1. Raise the pin only together with the Node
version in the Setup node step.

Also guards the crates.io publish against a version already on the index. The
two registries can now diverge -- 5.0.0 is live on crates.io and absent from
npm -- and the only way to retry npm is another release commit, which would
otherwise fail here on "crate version is already uploaded" and hide the npm
result behind a red crates job.

The guard's User-Agent header is required: without it crates.io answers in a
way that reads exactly like "not published", which would silently invert it
into always-publish. Control-tested against the live index -- 5.0.0 matches,
a bogus 9.9.9 does not.

Refs #37

Co-Authored-By: Claude <noreply@anthropic.com>
@MichaelTaylor3d
MichaelTaylor3d merged commit a53426d into main Aug 27, 2026
20 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the fix/npm-publish-engine branch August 27, 2026 00:21
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