Skip to content

Commit 192d484

Browse files
committed
Fix CD tag generation
1 parent 72678ed commit 192d484

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/cd.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,19 @@ jobs:
124124
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
125125
echo "Latest tag: $LATEST_TAG"
126126
127-
# Increment patch version
127+
# Increment patch version until we find an available tag
128128
VERSION=${LATEST_TAG#v}
129129
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
130130
NEW_PATCH=$((PATCH + 1))
131131
NEW_TAG="v${MAJOR}.${MINOR}.${NEW_PATCH}"
132132
133+
# Keep incrementing if tag already exists
134+
while git ls-remote --tags origin | grep -q "refs/tags/$NEW_TAG"; do
135+
echo "Tag $NEW_TAG already exists, incrementing..."
136+
NEW_PATCH=$((NEW_PATCH + 1))
137+
NEW_TAG="v${MAJOR}.${MINOR}.${NEW_PATCH}"
138+
done
139+
133140
echo "New tag: $NEW_TAG"
134141
echo "tag=$NEW_TAG" >> $GITHUB_OUTPUT
135142
echo "auto_generated=true" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)