From 483511f3d7dfd9beda233ac099c2b552624f98cb Mon Sep 17 00:00:00 2001 From: Torsten Ueberschar Date: Sat, 31 Oct 2026 09:57:25 +0000 Subject: [PATCH] =?UTF-8?q?fix(bump):=20Schutz=20vor=20Doppel-Tags=20nur?= =?UTF-8?q?=20f=C3=BCr=20Tags=20derselben=20Art=20(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Schutz „Commit trägt schon ein v-Tag, nichts tun“ zählt jetzt nur Tags derselben Art (dev, beta, stabil). Vorher hätte ein dev-Tag nach einem Fast-Forward-Merge in `release/*` das Beta-Tag und damit Build und Deploy nach beta verhindert. Getestet im lokalen Harness: Feature vom Release-Head taggen, Fast-Forward nach `release/2.4`, Lauf auf release ergibt `v2.4.1-beta.2` auf demselben Commit; erneuter Lauf tut nichts. Release als `bump-v2.0.1`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: https://git.uesome.de/actions/ci-cd/pulls/5 --- 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"