From b7ba358c9501c78a2591ad7fc18b445fa9b6b6d7 Mon Sep 17 00:00:00 2001 From: Sameeul B Samee Date: Thu, 19 Mar 2026 16:35:58 -0400 Subject: [PATCH] fix: ensure workflows checkout exact tag for clean version detection - Add ref: ${{ github.ref }} to checkout action to ensure we're on the exact tag - Add git state verification step to confirm we're on exact tag - Add setuptools-scm verification to display detected version in logs This fixes the issue where setuptools-scm was detecting 2.2.2.post1.dev0 instead of clean 2.2.2 because the checkout wasn't at the exact tag commit. With this fix, wheels will be built with clean version numbers (e.g., 2.2.2) instead of post-release dev versions (e.g., 2.2.2.post1.dev0). --- .github/workflows/publish_pypi.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index 7704dbd..3d8cd3b 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -22,6 +22,7 @@ jobs: - uses: actions/checkout@v3 name: Check out with: + ref: ${{ github.ref }} # Explicitly checkout the triggering ref (tag) fetch-depth: 0 # Fetch all history for setuptools-scm fetch-tags: true # Explicitly fetch tags @@ -37,6 +38,14 @@ jobs: with: python-version: '3.11' + - name: Verify git state + run: | + echo "Git ref: ${{ github.ref }}" + echo "Git ref name: ${{ github.ref_name }}" + git describe --tags --exact-match 2>/dev/null && echo "✅ On exact tag" || echo "⚠️ Not on exact tag" + git describe --tags --long + shell: bash + - name: Update version files run: | python -m pip install setuptools-scm @@ -48,6 +57,9 @@ jobs: else python scripts/update_versions.py fi + # Verify setuptools-scm version detection + echo "setuptools-scm detects version:" + python -m setuptools_scm shell: bash - name: Install cibuildwheel @@ -104,6 +116,7 @@ jobs: - uses: actions/checkout@v3 name: Check out with: + ref: ${{ github.ref }} # Explicitly checkout the triggering ref (tag) fetch-depth: 0 # Fetch all history for setuptools-scm fetch-tags: true # Explicitly fetch tags @@ -119,6 +132,14 @@ jobs: with: python-version: '3.11' + - name: Verify git state + run: | + echo "Git ref: ${{ github.ref }}" + echo "Git ref name: ${{ github.ref_name }}" + git describe --tags --exact-match 2>/dev/null && echo "✅ On exact tag" || echo "⚠️ Not on exact tag" + git describe --tags --long + shell: bash + - name: Update version files run: | python -m pip install setuptools-scm @@ -130,6 +151,9 @@ jobs: else python scripts/update_versions.py fi + # Verify setuptools-scm version detection + echo "setuptools-scm detects version:" + python -m setuptools_scm shell: bash - name: Install cibuildwheel