| 1 |
name: Build and upload to PyPI |
| 2 |
|
| 3 |
env: |
| 4 |
# skip EOL interpreters |
| 5 |
CIBW_SKIP: "cp36-* cp37-* cp38-* pp*" |
| 6 |
|
| 7 |
on: |
| 8 |
workflow_dispatch: |
| 9 |
|
| 10 |
jobs: |
| 11 |
build_wheels: |
| 12 |
name: Build wheels on ${{ matrix.os }} |
| 13 |
runs-on: ${{ matrix.os }} |
| 14 |
strategy: |
| 15 |
matrix: |
| 16 |
os: [ubuntu-latest, macos-latest] |
| 17 |
|
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v3 |
| 20 |
|
| 21 |
- name: Build wheels |
| 22 |
uses: pypa/[email protected] |
| 23 |
|
| 24 |
- name: Upload wheels |
| 25 |
uses: actions/upload-artifact@v4 |
| 26 |
with: |
| 27 |
name: wheels-${{ matrix.os }} |
| 28 |
path: ./wheelhouse/*.whl |
| 29 |
|
| 30 |
build_sdist: |
| 31 |
name: Build source distribution |
| 32 |
runs-on: ubuntu-latest |
| 33 |
steps: |
| 34 |
- uses: actions/checkout@v3 |
| 35 |
|
| 36 |
- name: Build sdist |
| 37 |
run: pipx run build --sdist |
| 38 |
|
| 39 |
- name: Upload sdist |
| 40 |
uses: actions/upload-artifact@v4 |
| 41 |
with: |
| 42 |
name: sdist |
| 43 |
path: dist/*.tar.gz |
| 44 |
|
| 45 |
upload_pypi: |
| 46 |
needs: [build_wheels, build_sdist] |
| 47 |
runs-on: ubuntu-latest |
| 48 |
steps: |
| 49 |
- name: Download all artifacts |
| 50 |
uses: actions/download-artifact@v4 |
| 51 |
with: |
| 52 |
path: dist |
| 53 |
merge-multiple: true |
| 54 |
|
| 55 |
- name: Publish to PyPI |
| 56 |
uses: pypa/gh-action-pypi-publish@release/v1 # stay on latest 1.x |
| 57 |
with: |
| 58 |
user: __token__ # default, but kept explicit |
| 59 |
password: ${{ secrets.PYPI_API_TOKEN }} # new secret |
| 60 |
verbose: true |