fix(ci): publish to npm on Node 24 and make a failed publish retryable - #165
Merged
Conversation
The v3.12.0 release tagged and published the GitHub Release, then died on
the npm step:
npm error notsup Required: {"node":"^22.22.2 || ^24.15.0 || >=26.0.0"}
npm error notsup Actual: {"npm":"10.8.2","node":"v20.20.2"}
`npm install -g npm@latest` (needed for OIDC trusted publishing) now
resolves to npm 12, which refuses Node 20. Bump the publish step to Node 24.
That left the release unrecoverable: the publish steps were gated on
`tag.outputs.created == 'true'`, and the tag already existed from the failed
attempt, so every retry skipped the publish. Two changes make it recoverable:
- Gate on whether the version is already on npm. The registry is the real
source of truth for what shipped, and it rejects duplicate versions anyway.
- Add a workflow_dispatch retry hatch taking an existing tag. Re-running the
original run cannot work - GitHub replays the workflow file from that
commit, bugs included. Dispatch checks out the tag and re-drives the
publish from the current workflow file.
Tag creation now keys off the checked-out commit rather than $GITHUB_SHA,
which on a dispatch is master HEAD rather than the release tag.
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.
The failure
v3.12.0tagged and published its GitHub Release, then died on the npm step (run):npm install -g npm@latest- which the OIDC trusted-publishing flow needs - now resolves to npm 12, and npm 12 refuses Node 20. npm is still on3.11.0while the tag and GitHub Release say3.12.0.Why it was stuck
The publish steps were gated on
steps.tag.outputs.created == 'true'. The tag was created on the first (failed) attempt, so every retry after that evaluated the gate tofalseand silently skipped the publish. Re-running the original run does not help either - GitHub replays the workflow file as of that commit, Node 20 pin included.Changes
npm view <pkg>@<version>decides whether to publish. The registry is the source of truth for what shipped, and it rejects duplicate versions anyway - so this is both idempotent and self-healing.workflow_dispatchretry hatch taking an existing tag. It checks out that tag and re-drives the publish from the current workflow file. Guarded so the dispatched tag must equalv$(version.json)at that ref.$GITHUB_SHA, which on a dispatch is master HEAD rather than the release tag.Test plan
validatepassesTag and Publish Releasewith tagv3.12.0to finish the stuck releasenpm view @antonbabenko/deliberation-mcp versionreports3.12.0