| 1 |
name: Build and upload to PyPI |
| 2 |
|
| 3 |
on: |
| 4 |
release: |
| 5 |
types: [published] |
| 6 |
workflow_dispatch: |
| 7 |
|
| 8 |
jobs: |
| 9 |
build_wheels: |
| 10 |
name: Build wheels on ${{ matrix.os }} |
| 11 |
runs-on: ${{ matrix.os }} |
| 12 |
strategy: |
| 13 |
matrix: |
| 14 |
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-latest, macos-latest] |
| 15 |
|
| 16 |
steps: |
| 17 |
- uses: actions/checkout@v7 |
| 18 |
|
| 19 |
- uses: actions/setup-python@v7 |
| 20 |
|
| 21 |
- name: Build wheels |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
continue-on-error: true |
| 26 |
uses: pypa/[email protected] |
| 27 |
|
| 28 |
- uses: actions/upload-artifact@v7 |
| 29 |
with: |
| 30 |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 31 |
path: ./wheelhouse/*.whl |
| 32 |
|
| 33 |
build_sdist: |
| 34 |
name: Build source distribution |
| 35 |
runs-on: ubuntu-24.04 |
| 36 |
steps: |
| 37 |
- uses: actions/checkout@v7 |
| 38 |
|
| 39 |
- uses: actions/setup-python@v7 |
| 40 |
|
| 41 |
- name: Install build |
| 42 |
run: python -m pip install build |
| 43 |
|
| 44 |
- name: Build sdist |
| 45 |
run: python -m build --sdist |
| 46 |
|
| 47 |
- uses: actions/upload-artifact@v7 |
| 48 |
with: |
| 49 |
name: cibw-sdist |
| 50 |
path: dist/*.tar.gz |
| 51 |
|
| 52 |
upload_pypi: |
| 53 |
name: Upload to PyPI |
| 54 |
needs: [build_wheels, build_sdist] |
| 55 |
runs-on: ubuntu-24.04 |
| 56 |
permissions: |
| 57 |
id-token: write |
| 58 |
if: startsWith(github.ref, 'refs/tags/v') |
| 59 |
steps: |
| 60 |
- uses: actions/download-artifact@v8 |
| 61 |
with: |
| 62 |
pattern: cibw-* |
| 63 |
path: dist |
| 64 |
merge-multiple: true |
| 65 |
|
| 66 |
- uses: pypa/gh-action-pypi-publish@release/v1 |