From baf69b73e6c77d8ff93b5a12bdbc22e2fe437387 Mon Sep 17 00:00:00 2001 From: Andrew Nelson Date: Wed, 30 Jul 2025 18:19:32 +1000 Subject: [PATCH 1/2] BLD: check tag --- .github/workflows/wheels.yml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e79cc37..040196b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -239,10 +239,40 @@ jobs: print-hash: true attestations: true + check_version: + name: Ensure commit is tag before upload to PyPi + + #if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + steps: + - name: Checkout numpy + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: numpy/numpy + ref: ${{ env.SOURCE_REF_TO_BUILD }} + path: numpy-src + fetch-depth: 0 + fetch-tags: true + submodules: false + persist-credentials: false + + - name: Examine git commit + run: | + cd numpy-src + hash=$(git describe HEAD) + echo $hash + if [[ $hash == *"-"*"-"* ]]; then + echo "SOURCE_REF_TO_BUILD is not a tag" + exit 1 + else + echo "SOURCE_REF_TO_BUILD is a tag" + fi; + pypi-publish: name: Publish release to PyPI if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' - needs: [build_wheels, build_sdist] + needs: [check_version] runs-on: ubuntu-latest environment: name: pypi From 0145d03c20c98d635865914d69d2bce9880a1968 Mon Sep 17 00:00:00 2001 From: Andrew Nelson Date: Mon, 11 Aug 2025 11:17:24 +1000 Subject: [PATCH 2/2] Update .github/workflows/wheels.yml --- .github/workflows/wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 040196b..4e34445 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -242,7 +242,7 @@ jobs: check_version: name: Ensure commit is tag before upload to PyPi - #if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' + if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'pypi' needs: [build_wheels, build_sdist] runs-on: ubuntu-latest steps: