Skip to content

fix(semantic-release): only emit tag output for newly created releases#49

Merged
dotkas merged 1 commit intomainfrom
dotkas/fix-semantic-release-bugfix
Apr 23, 2026
Merged

fix(semantic-release): only emit tag output for newly created releases#49
dotkas merged 1 commit intomainfrom
dotkas/fix-semantic-release-bugfix

Conversation

@dotkas
Copy link
Copy Markdown
Contributor

@dotkas dotkas commented Apr 23, 2026

Problem

The Resolve release outputs step uses:

TAG=$(git tag --points-at HEAD --sort=-v:refname | head -1)

This picks up any tag pointing at HEAD, including tags created by a prior workflow run on a different branch. In our main↔develop backmerge flow that causes a real failure:

  1. PR merged developmain (commit X)
  2. main workflow runs semantic-release → creates v1.5.0 at X, uploads release assets, then backmerges maindevelop (push of identical SHA X)
  3. The backmerge push triggers the develop workflow on commit X
  4. semantic-release on develop has nothing new to release
  5. But git tag --points-at HEAD returns v1.5.0 (created by the main run), so outputs.tag=v1.5.0 is emitted
  6. Downstream gh release upload v1.5.0 … fails: asset under the same name already exists

Observed in:

Fix

Snapshot the tag set at HEAD before running semantic-release, then diff with the post-run set. Only tags that did not previously exist are reported as new releases.

Verified

Manually tested the shell logic:

  • New release: emits the new tag ✅
  • No-op (backmerge scenario): emits empty ✅
  • First-ever release: emits the new tag ✅

The 'Resolve release outputs' step used `git tag --points-at HEAD` to
discover the released tag, which also picked up tags created by prior
workflow runs on different branches. After a main→develop backmerge of
the same commit, the develop run would re-emit the main release tag
(e.g. v1.5.0), causing downstream upload steps to fail with 'asset
under the same name already exists'.

Snapshot the tag set at HEAD before running semantic-release and only
emit tags that did not exist beforehand.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotkas dotkas merged commit 5410de5 into main Apr 23, 2026
3 checks passed
@dotkas dotkas deleted the dotkas/fix-semantic-release-bugfix branch April 23, 2026 08:53
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