fix: nightly whl dev date suffix (#18873)

This commit is contained in:
Douglas Yang
2026-02-16 10:57:37 +08:00
committed by GitHub
parent 0ffd0a3995
commit 45715af50c
+16 -18
View File
@@ -54,28 +54,26 @@ jobs:
cd python cd python
cp ../README.md ../LICENSE . cp ../README.md ../LICENSE .
# Parse git describe output to detect exact tag builds (distance=0) # Parse git describe output to get latest tag
# Use same command as pyproject.toml to ensure version consistency # Use same command as pyproject.toml to ensure version consistency
DESC=$(git tag --list --sort=-version:refname 'v*.*.*' | head -1 | xargs git describe --tags --long 2>/dev/null || echo 'v0.0.0-0-g0000000') DESC=$(git tag --list --sort=-version:refname 'v*.*.*' | head -1 | xargs git describe --tags --long 2>/dev/null || echo 'v0.0.0-0-g0000000')
DIST=$(echo "$DESC" | cut -d- -f2) TAG=$(echo "$DESC" | cut -d- -f1)
HASH="g$(git rev-parse --short HEAD)"
BUILD_DATE=$(date -u +%Y%m%d)
# If building at exact tag (distance=0), force dev0 version for unique wheel names # Increment patch version for nightlies (e.g., v0.5.8 -> 0.5.9)
if [ "$DIST" = "0" ]; then VERSION=${TAG#v} # Remove 'v' prefix
TAG=$(echo "$DESC" | cut -d- -f1) MAJOR=$(echo "$VERSION" | cut -d. -f1)
HASH="g$(git rev-parse --short HEAD)" MINOR=$(echo "$VERSION" | cut -d. -f2)
PATCH=$(echo "$VERSION" | cut -d. -f3)
NEXT_PATCH=$((PATCH + 1))
NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}"
# Increment patch version for nightlies (e.g., v0.5.8 -> 0.5.9.dev0) # Use date-based dev number for correct chronological sorting
VERSION=${TAG#v} # Remove 'v' prefix # e.g., 0.5.9.dev20260215+g4cf4f0859 > 0.5.9.dev20260214+g45a4697d4
MAJOR=$(echo "$VERSION" | cut -d. -f1) FORCE_VERSION="${NEXT_VERSION}.dev${BUILD_DATE}+${HASH}"
MINOR=$(echo "$VERSION" | cut -d. -f2) echo "Forcing nightly version to: $FORCE_VERSION"
PATCH=$(echo "$VERSION" | cut -d. -f3) export SETUPTOOLS_SCM_PRETEND_VERSION="$FORCE_VERSION"
NEXT_PATCH=$((PATCH + 1))
NEXT_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}"
FORCE_VERSION="${NEXT_VERSION}.dev0+${HASH}"
echo "Building at exact tag $TAG, forcing nightly version to: $FORCE_VERSION"
export SETUPTOOLS_SCM_PRETEND_VERSION="$FORCE_VERSION"
fi
# Build wheel # Build wheel
python3 -m build --wheel python3 -m build --wheel