fix: skip existing runtime autobump tags #1229

Closed
hongming wants to merge 1 commits from fix/runtime-autobump-next-free-tag into main
@@ -113,16 +113,19 @@ 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"
PATCH=$((PATCH+1))
VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "PyPI latest=$LATEST -> first candidate=$VERSION"
while git tag --list | grep -qx "runtime-v$VERSION"; do
echo "::notice::tag runtime-v$VERSION already exists; trying next patch version"
PATCH=$((PATCH+1))
VERSION="${MAJOR}.${MINOR}.${PATCH}"
done
echo "selected next free version=$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)."
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Push runtime-v$VERSION tag