Repository navigation
ci: allow retrying npm publish for an existing release tag - #86
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The manual path needs stronger tag provenance validation, and its documented recovery scope needs clarification.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Enables safe npm publish retries for existing release tags while publishing the exact tagged artifact.
Changes:
- Adds manual tag-based publishing and release/version validation.
- Separates release creation from npm publishing.
- Documents the retry procedure.
| File | Description |
|---|---|
.github/workflows/release.yml |
Adds the guarded publish job and manual trigger. |
README.md |
Documents failed-publish retries. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Member
Author
|
Thanks |
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
Allow retrying
npm publishfor a release whose tag already exists, and publish exactly what was tagged.Today release-please creates the tag and GitHub Release before
npm publishruns. If publishing fails, re-running the workflow skips it, becauserelease_createdis false on a re-run. In the 1.5.0 incident (#32), the workaround of deleting the tag broke release-please's baseline..github/workflows/release.yml:workflow_dispatchtrigger with a requiredtaginput (for exampledeploygate--v1.5.2). It stays inrelease.yml, because npm trusted publishing is bound to this workflow file.release-pleasejobpush.release_createdandtag_nameas job outputs. These are the root-package output names in release-please-action v5 (src/index.ts).id-token: write.publishjobworkflow_dispatch, and hascontents: readandid-token: write.deploygate--vX.Y.Z), checks out the tag, and verifies that thepackage.jsonversion matches the tag.main(git merge-base --is-ancestor), so a manual run can't publish unreviewed code.env; norun:script interpolates${{ }}.npm run bundlebeforenpm publish. Theplugin/scripts/bundle.jscommitted at the tag is published as-is, so npm and git always ship the same file. Check that the committed bundle is up to date on release PRs #81 / ci: check that the committed bundle is up to date on release PRs #85 make sure that committed bundle is up to date.README.md: a new "Retrying a failed npm publish" subsection at the end of "Releasing". It covers transient or external failures (Actions → Release → Run workflow → tag), and says that failures caused by the tagged files need a newfix:release instead. It doesn't touch the lines that #84 edits.Related Issue
Closes #82
Type of change
Test plan
npm run buildpassesnpm testpasses (235 tests)Manually verified the change (describe how below)
I parsed the workflow with the
yamlpackage. It shows the jobsrelease-pleaseandpublish, the triggerspush(main) andworkflow_dispatch(tag), and the expected permissions per job.bash -npasses on everyrun:script in thepublishjob.I ran the guard scripts locally with a stubbed
TAGandGITHUB_OUTPUT, againstpackage.jsonfrom tagdeploygate--v1.5.2.npm publishwas never run.TAGdeploygate--v1.5.2skip=true, exit 0deploygate--v9.9.9package.json version 1.5.2 does not match tag→ exit 1foo; rm -rf /Invalid release tag→ exit 1, before checkoutdeploygate--v9.9.9,package.jsonstubbed to 9.9.9npm viewreturns E404 →skip=false, publish pathdeploygate--v1.5.2,npmstubbed to fail withENOTFOUNDCould not check npm→ exit 1, no publish attemptThe reachability guard allows
deploygate--v1.5.2(onmain) and refuses this PR's own head commit (not onmain).Which jobs run for each event:
release-pleasepublishtag_namerelease-pleasefailsworkflow_dispatchinputs.tag(!cancelled()overrides the skippedneeds)The OIDC publish and the
refs/tags/checkout can't be exercised outside GitHub Actions. They'll first run on the next release, or on a manual run against an already-published tag, which only takes the skip path.Checklist
plugin/.codex-plugin/plugin.jsonandplugin/.claude-plugin/plugin.jsonif applicable (not applicable: CI only)🤖 Generated with Claude Code