fix: image version in pypi pr workflow (#18735)

This commit is contained in:
Douglas Yang
2026-02-12 08:18:01 -08:00
committed by GitHub
parent 9e9e949261
commit e730c728d3

View File

@@ -34,13 +34,14 @@ jobs:
- name: Generate PR wheel version
id: gen_version
run: |
# Get base version from setuptools_scm
cd python
pip install setuptools-scm
FULL_VERSION=$(python -c "from setuptools_scm import get_version; print(get_version(root='..'))")
# Strip any existing .dev or + suffix to get clean base version
BASE_VERSION=$(echo "$FULL_VERSION" | sed 's/\.dev.*//;s/+.*//')
cd ..
# Get base version from the latest v*.*.* git tag directly
# Note: We cannot use setuptools_scm here because the [tool.setuptools_scm]
# config (with custom git_describe_command) lives in python/pyproject.toml,
# not at the repo root. Without that config, setuptools_scm falls back to
# default git describe which finds gateway-* tags instead of v*.*.* release tags.
LATEST_TAG=$(git tag --list --sort=-version:refname 'v*.*.*' | head -1)
BASE_VERSION=${LATEST_TAG#v}
echo "Latest release tag: ${LATEST_TAG}"
# Get commit info
COMMIT_HASH=$(git rev-parse --short HEAD)