fix(bump): Schutz vor Doppel-Tags nur für Tags derselben Art (#5)
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: #5
This commit was merged in pull request #5.
This commit is contained in:
1 parent
035550e183
commit
483511f3d7
2 files changed
+15
-7
No files matched your search
@@ -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.…`).
|
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:
|
Settings:
|
||||||
|
|
||||||
|
|||||||
+14
-6
@@ -45,12 +45,6 @@ if [[ $head != "$SHA" ]]; then
|
|||||||
fi
|
fi
|
||||||
git checkout --quiet "$SHA"
|
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; }
|
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
|
# "2.4" or "v2.4.1" -> "2.4.0" / "2.4.1"; fails for anything else
|
||||||
@@ -150,6 +144,20 @@ case $BRANCH in
|
|||||||
esac
|
esac
|
||||||
TAG=v$VERSION
|
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"
|
git tag "$TAG"
|
||||||
if ! git push --quiet origin "refs/tags/$TAG"; then
|
if ! git push --quiet origin "refs/tags/$TAG"; then
|
||||||
echo "bump: push of $TAG rejected, the newer pipeline bumps"
|
echo "bump: push of $TAG rejected, the newer pipeline bumps"
|
||||||
|
|||||||
Reference in new issue
Block a user