diff --git a/.github/workflows/release-pypi-nightly.yml b/.github/workflows/release-pypi-nightly.yml index 92759f340..0db69ff7e 100644 --- a/.github/workflows/release-pypi-nightly.yml +++ b/.github/workflows/release-pypi-nightly.yml @@ -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