Skip to content

Release the tag that was pushed, not the rc - #23

Merged
sergeyfast merged 1 commit into
masterfrom
fix/goreleaser-tag-selection
Sep 16, 2026
Merged

sergeyfast merged 1 commit into
masterfrom
fix/goreleaser-tag-selection

Conversation

@sergeyfast

Copy link
Copy Markdown
Member

The v0.1.6 release run failed. The tag sits on 8f9012d, the same
commit as v0.1.6-rc.2 — the normal case when a release candidate
needs no further fixes — and goreleaser rebuilt the rc instead:

• using tags   previous=v0.1.5 current=v0.1.6-rc.2
⨯ release failed: failed to upload topsrv_0.1.6-rc.2_linux_amd64.tar.gz:
  422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists}]

Left to itself goreleaser picks among the tags pointing at HEAD with
--sort=-version:refname, and git's versionsort ranks the rc higher
unless versionsort.suffix is configured — it reads -rc.2 as more
refname, not as a semver prerelease:

$ git tag --points-at 8f9012d --sort=-version:refname
v0.1.6-rc.2
v0.1.6

So every artifact carried the rc version, and the upload then died on
the rc's own release, which already holds those asset names since
8 September. That release is unharmed — the 422 is what protected it —
and no v0.1.6 release was created.

GORELEASER_CURRENT_TAG pins the build to github.ref_name, the tag
the workflow was triggered by. Setting versionsort.suffix instead
would work too, but it fixes the ordering by enumerating suffixes we
happen to use today; taking the tag from the trigger has nothing to
guess.

The fix has to land in master before v0.1.6 can ship: CI reads the
workflow from the tagged ref, so the tag must point at a commit that
carries it. Once this merges I'll move v0.1.6 onto the new master
HEAD and push — the current tag has no release behind it, so nothing
downstream can have consumed it.

goreleaser picks among the tags pointing at HEAD with
`--sort=-version:refname`, and git's versionsort ranks
`v0.1.6-rc.2` above `v0.1.6` unless `versionsort.suffix` is set:
it reads the suffix as more refname, not as a semver prerelease.

A final tag placed on the same commit as its last release
candidate — the normal case when the rc needed no further fixes —
therefore rebuilt the rc. Every artifact carried the rc version and
the upload died 422, because the rc's own release already held
those asset names. v0.1.6 failed exactly this way.

GORELEASER_CURRENT_TAG pins the build to `github.ref_name`, which
is the tag the workflow was triggered by.
@sergeyfast
sergeyfast merged commit 657ad1f into master Sep 16, 2026
2 checks passed
@sergeyfast
sergeyfast deleted the fix/goreleaser-tag-selection branch September 16, 2026 08:43
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