Skip to content

Commit

Permalink
Update upload_to_pypi.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Dec 15, 2024
1 parent 0bc5722 commit c0e435c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/upload_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ name: Build and upload to PyPI

on:
release:
types: [published]
types: [published, edited]
push:
# branches:
# - main

jobs:
build_wheels:
Expand All @@ -17,18 +20,17 @@ jobs:

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.x'

- name: Build wheels
# For very recent Python versions, wheels from e.g. numpy might not be
# available yet which can cause the build to fail. Keep going, and upload
# the wheels for all of the previous versions when that happens.
continue-on-error: true
uses: pypa/cibuildwheel@v2.20.0
uses: pypa/cibuildwheel@v2.22.0

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
Expand All @@ -39,8 +41,6 @@ jobs:

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.x'

- name: Install build
run: python -m pip install build
Expand All @@ -50,17 +50,22 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down

0 comments on commit c0e435c

Please sign in to comment.