Skip to content

fix: skip a version already published instead of failing the release - #331

Merged
ignaciocapodanno merged 1 commit into
mainfrom
handle-already-published
Oct 29, 2026
Merged

ignaciocapodanno merged 1 commit into
mainfrom
handle-already-published

Conversation

@ignaciocapodanno

Copy link
Copy Markdown
Contributor

Description

A release that already published cannot be re-run today. The npm step fails with You cannot publish over the previously published versions, and because the GitHub Packages step runs after it in the same job, the mirror is skipped and never gets a chance.

Each publish step now asks the registry it is about to publish to whether that version is already there, and skips it if so. Anything else still fails the job.

This unblocks 0.23.2, which is on npm but not on GitHub Packages. Re-running its release will skip npm and publish the mirror.

Links

Failed run

Risks and recovery

CI only, nothing in the published package changes. The check is scoped to one case, a version already present on that registry; credential, network and permission failures still fail the job as before. Reverting the commit is enough.

Checklist:

  • I have performed a self-review of my own code.
  • I have added or updated tests to cover my changes, or explained why not.
  • I have manually tested my change on staging / canaried my change, or explained why not.

Testing

A workflow step cannot run outside Actions, so the registry checks were run locally against both real registries, each with the same npmrc its step builds:

  • npm: 0.23.2 found, so it skips. 9.9.9 not found, so it publishes.
  • GitHub Packages: 0.23.0 found, so it skips. 0.23.1 and 0.23.2 not found, so it publishes.

That last line is the one that matters: re-running the 0.23.2 release will skip npm and publish the mirror.

Also checked that the workflow still parses and that both steps keep their env.

Not proven until this merges: that yarn publish against GitHub Packages now succeeds. The repo was given write access to the package yesterday, and the mirror has not run since.

@ignaciocapodanno
ignaciocapodanno marked this pull request as ready for review October 29, 2026 13:09
@ignaciocapodanno
ignaciocapodanno requested a review from a team October 29, 2026 13:09
@ignaciocapodanno
ignaciocapodanno merged commit c46b978 into main Oct 29, 2026
5 checks passed
@ignaciocapodanno
ignaciocapodanno deleted the handle-already-published branch October 29, 2026 15:20
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.

2 participants