fix(autobump): skip existing runtime-v* tags instead of failing (mc#1229) #1231

Closed
core-devops wants to merge 1 commits from fix/autobump-skip-existing-tags into staging
+18 -8
View File
@@ -113,14 +113,24 @@ jobs:
MAJOR=$(echo "$LATEST" | cut -d. -f1)
MINOR=$(echo "$LATEST" | cut -d. -f2)
PATCH=$(echo "$LATEST" | cut -d. -f3)
VERSION="${MAJOR}.${MINOR}.$((PATCH+1))"
echo "PyPI latest=$LATEST -> next=$VERSION"
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "::error::computed version $VERSION does not match PEP 440 X.Y.Z"
exit 1
fi
if git tag --list | grep -qx "runtime-v$VERSION"; then
echo "::error::tag runtime-v$VERSION already exists in this repo. Manual intervention required (PyPI and Gitea tag history are out of sync)."
# mc#1229: skip existing tags instead of failing
FOUND=0
for ATTEMPT in $(seq $((PATCH+1)) $((PATCH+100))); do
VERSION="${MAJOR}.${MINOR}.${ATTEMPT}"
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "::error::computed version $VERSION does not match PEP 440 X.Y.Z"
exit 1
fi
if git tag --list | grep -qx "runtime-v$VERSION"; then
echo "runtime-v$VERSION already exists — skipping to next patch"
else
echo "PyPI latest=$LATEST -> found free tag runtime-v$VERSION (skipped $((ATTEMPT-PATCH-1)) collision(s))"
FOUND=1
break
fi
done
if [ "$FOUND" -eq 0 ]; then
echo "::error::no free tag found in ${MAJOR}.${MINOR}.$((PATCH+1))..${MAJOR}.${MINOR}.$((PATCH+100)) — manual intervention required"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"