fix: nightly wheel naming for non-post versions (#17538)

This commit is contained in:
Douglas Yang
2026-01-23 20:51:52 -08:00
committed by GitHub
parent d0919be733
commit 58799d91a7

View File

@@ -49,7 +49,21 @@ jobs:
cd python
cp ../README.md ../LICENSE .
# Build wheel - setuptools-scm automatically generates version from git tags
# Parse git describe output to detect exact tag builds (distance=0)
# 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')
DIST=$(echo "$DESC" | cut -d- -f2)
# If building at exact tag (distance=0), force dev0 version for unique wheel names
if [ "$DIST" = "0" ]; then
TAG=$(echo "$DESC" | cut -d- -f1)
HASH=$(echo "$DESC" | cut -d- -f3-)
FORCE_VERSION="${TAG#v}.dev0+${HASH}"
echo "Building at exact tag, forcing version to: $FORCE_VERSION"
export SETUPTOOLS_SCM_PRETEND_VERSION="$FORCE_VERSION"
fi
# Build wheel
python3 -m build --wheel
# Extract version from built wheel filename