Update sdist and wheel actions #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Wheels | ||
on: | ||
# Triggers the workflow on manual dispatch or when a release is published | ||
workflow_dispatch: | ||
release: | ||
types: | ||
- published | ||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
with: | ||
output-dir: wheelhouse | ||
- name: Verify clean directory | ||
run: git diff --exit-code | ||
shell: bash | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }} | ||
path: wheelhouse/*.whl | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
build_sdist: | ||
name: Build SDist | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Build SDist | ||
run: pipx run build --sdist | ||
- name: Check metadata | ||
run: pipx run twine check dist/* | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
upload_all: | ||
name: Upload if release | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/setup-python@v4 | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist | ||
- uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} |