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"