Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
PTNobel authored Aug 25, 2024
1 parent ad7b8d8 commit 87a203a
Showing 1 changed file with 40 additions and 15 deletions.
55 changes: 40 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,56 @@ jobs:
pytest
rm -rf build/
jobs:
build_wheels:
needs: build
if: ${{github.event_name == 'push'}}
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
- name: Build wheels
uses: pypa/[email protected]

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

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
pip install wheel
python setup.py sdist bdist_wheel

- name: publish
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
- name: Build sdist
run: pipx run build --sdist

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

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 87a203a

Please sign in to comment.