Publish a release only for a tag on a commit on main #17
No reviewers
Labels
No labels
Kind/Bug
Kind/Chore
Kind/Docs
Kind/Feature
Kind/Security
Priority
High
Priority
Low
Reviewed
Duplicate
Reviewed
Invalid
Status
Blocked
Status
Needs-Decision
Status
Wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
Strawly-Music/desktop!17
Loading…
Reference in a new issue
No description provided.
Delete branch "tag-on-main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tags on main only
A
v*tag published a release from whatever commit it pointed at. A tag pushed on a side branch by mistake would have built and published that branch as a release.The "Work out the version" step now checks, for a tag, that the tagged commit is on
main, before the version and changelog checks and before the build. The checkout fetches only the tagged commit, so the step first fetches the history ofmain(with--unshallowwhen the checkout is shallow), then runsgit merge-base --is-ancestor HEAD FETCH_HEAD. It passes for the merge commit and for any older commit onmain. When it fails, the job stops with:The release job needs the build job, so nothing is published. Pushes to
mainskip this, and keep the shallow checkout.HEADis used instead ofGITHUB_SHA, since it is the commit even for an annotated tag.The workflow's header comment and the README's release paragraph mention the rule.
Checked
In a scratch copy of the repository, with a shallow checkout of one tag as in CI:
v0.2.0andv0.1.0pass, and a tag on a commit on a side branch fails with the message above. With a full clone,v0.2.0passes and the side-branch tag fails. The workflow file parses as YAML.