File tree Expand file tree Collapse file tree 1 file changed +28
-15
lines changed
Expand file tree Collapse file tree 1 file changed +28
-15
lines changed Original file line number Diff line number Diff line change 2424 id : get_tag
2525 run : |
2626 git fetch --tags origin || true
27- LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
27+ # Get the absolute highest semantic version tag across all history
28+ LATEST_TAG=$(git tag -l "v[0-9]*" | sort -V | tail -n 1)
29+ if [ -z "$LATEST_TAG" ]; then
30+ LATEST_TAG="v0.0.0"
31+ fi
32+
2833 if [[ $LATEST_TAG =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
2934 MAJOR="${BASH_REMATCH[1]}"
3035 MINOR="${BASH_REMATCH[2]}"
@@ -35,20 +40,28 @@ jobs:
3540 PATCH=0
3641 fi
3742
38- PATCH=$((PATCH + 1))
39-
40- if [ "$PATCH" -ge 10 ]; then
41- MINOR=$((MINOR + 1))
42- PATCH=0
43- fi
44-
45- # Cascade minor bumps to major version
46- if [ "$MINOR" -ge 10 ]; then
47- MAJOR=$((MAJOR + 1))
48- MINOR=0
49- fi
50-
51- NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}"
43+ while true; do
44+ PATCH=$((PATCH + 1))
45+
46+ if [ "$PATCH" -ge 10 ]; then
47+ MINOR=$((MINOR + 1))
48+ PATCH=0
49+ fi
50+
51+ if [ "$MINOR" -ge 10 ]; then
52+ MAJOR=$((MAJOR + 1))
53+ MINOR=0
54+ fi
55+
56+ NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}"
57+
58+ # Check for conflict explicitly just in case
59+ if ! git rev-parse "refs/tags/$NEW_TAG" >/dev/null 2>&1; then
60+ break
61+ fi
62+ done
63+
64+ echo "NEW_TAG resolved to: $NEW_TAG"
5265 echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
5366
5467 - name : Update app.go version
You can’t perform that action at this time.
0 commit comments