fix(bump): Schutz vor Doppel-Tags nur für Tags derselben Art #5

Merged
tu merged 1 commits from fix/bump-same-kind-guard into develop 2026-10-31 09:57:26 +00:00
2 changed files with 15 additions and 7 deletions

No files matched your search

+1 -1
View File
@@ -182,7 +182,7 @@ Derives the next version for the pushed branch and pushes it as a tag on the tri
If the stable tag of a line exists (`v2.4.0` after the release), the next patch of that line is used (`v2.4.1-beta.0`, `v2.4.1-dev.…`).
Only the commit that triggered the pipeline is tagged; if the branch moved on, the step exits without a tag and the newer pipeline takes over. A commit that already carries a `v*` tag is not tagged again, so a re-run does not build twice.
Only the commit that triggered the pipeline is tagged; if the branch moved on, the step exits without a tag and the newer pipeline takes over. A commit that already carries a tag of the same kind (dev, beta or stable) is not tagged again, so a re-run does not build twice; a dev tag does not block the beta tag after a fast-forward merge.
Settings:
+14 -6
View File
@@ -45,12 +45,6 @@ if [[ $head != "$SHA" ]]; then
fi
git checkout --quiet "$SHA"
# A re-run must not produce a second tag and a second build for the same commit.
if existing=$(git tag --points-at HEAD 'v*' | head -n 1) && [[ -n $existing ]]; then
echo "bump: ${SHA:0:8} already carries $existing, nothing to do"
exit 0
fi
tag_exists() { git rev-parse -q --verify "refs/tags/v$1" >/dev/null; }
# "2.4" or "v2.4.1" -> "2.4.0" / "2.4.1"; fails for anything else
@@ -150,6 +144,20 @@ case $BRANCH in
esac
TAG=v$VERSION
# A re-run must not produce a second tag and a second build for the same commit.
# Only tags of the same kind count: a dev tag on a commit that is then merged
# fast-forward into a release branch must not block its beta tag.
case $TAG in
*-dev.*) same_kind='^v[0-9]+\.[0-9]+\.[0-9]+-dev\.' ;;
*-beta.*) same_kind='^v[0-9]+\.[0-9]+\.[0-9]+-beta\.' ;;
*) same_kind='^v[0-9]+\.[0-9]+\.[0-9]+$' ;;
esac
existing=$(git tag --points-at HEAD 'v*' | grep -E "$same_kind" | head -n 1 || true)
if [[ -n $existing ]]; then
echo "bump: ${SHA:0:8} already carries $existing, nothing to do"
exit 0
fi
git tag "$TAG"
if ! git push --quiet origin "refs/tags/$TAG"; then
echo "bump: push of $TAG rejected, the newer pipeline bumps"