fix: remove redundant tag push in release workflow#4
Merged
Conversation
gh release create already creates the git tag on the remote when it
doesn't yet exist (per gh release create --help). The separate 'Create
and push tag' step that followed it therefore attempted to push a tag
that already existed, which git rejected with:
! [rejected] v0.1.1 -> v0.1.1 (already exists)
Removing the redundant step lets gh release create own both the release
and the tag atomically. Downstream jobs (build-artifacts, publish-zed,
publish-neovim) already checkout ref: ${{ needs.tag-and-release.outputs.tag }}
and continue to work since the tag is created before they run.
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.
Problem
The release workflow (
.github/workflows/release.yml) failed on theCreate and push tagstep when merging the release PR intomain:Root cause
The tag is created twice within a single workflow run, not by two separate runs:
Create GitHub releaserunsgh release create "vX.Y.Z" .... Pergh release create --help:So this one command creates both the GitHub release and the
vX.Y.Ztag on the remote.Create and push tagthen rangit tag vX.Y.Z+git push origin vX.Y.Z. The push was rejected because the tag already existed on the remote — created by step 1.The idempotency check (
Check if tag already exists) didn't catch this because it only inspects the local clone beforegh release createruns. At that point the tag has never existed locally, sois_release=trueand both steps executed.Fix
Delete the redundant
Create and push tagstep.gh release createalready creates the tag at the latest commit onmain(which is exactly what the workflow is reacting to), so the manualgit tag+git pushwas duplicate work.Downstream jobs (
build-artifacts,publish-zed,publish-neovim) already check outref: ${{ needs.tag-and-release.outputs.tag }}and continue to work — the tag is created bygh release createbefore those jobs run.This also makes the workflow more robust, not just shorter: previously, if
gh release createsucceeded but the tag push failed, the release existed without a recoverable state. Now the release and tag are created atomically by a single command, and a failure leaves both absent so the next run retries cleanly.Verification
bun run check— clean (51 files, no fixes)bun test— 91 pass, 0 failgh release createstep preserved, downstream job refs intactgh release createauto-creates tags pergh release create --help