From 53906fdf14802052c624779636701f94083d75e2 Mon Sep 17 00:00:00 2001 From: Torsten Ueberschar Date: Sat, 31 Oct 2026 10:50:47 +0100 Subject: [PATCH] =?UTF-8?q?fix(bump):=20Schutz=20vor=20Doppel-Tags=20nur?= =?UTF-8?q?=20f=C3=BCr=20Tags=20derselben=20Art?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ein dev-Tag auf dem Commit darf nach einem Fast-Forward-Merge in einen Release-Branch das Beta-Tag nicht verhindern. Co-Authored-By: Claude Fable 5.1 --- README.md | 2 +- woodpecker/bump/bump.sh | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 392ac0e..d19575e 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/woodpecker/bump/bump.sh b/woodpecker/bump/bump.sh index ff88bbe..2fac881 100755 --- a/woodpecker/bump/bump.sh +++ b/woodpecker/bump/bump.sh @@ -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" -- 2.54.0