Skip to content

BLD: check that we're building a tag before PyPI upload #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading