Tackling issue #42 (#43) #92
This file contains 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: PyPI pkg | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- "v**" | |
release: | |
types: | |
- published | |
env: | |
# Build `universal2` and `arm64` wheels on an Intel runner. | |
# Note that the `arm64` wheel and the `arm64` part of the `universal2` | |
# wheel cannot be tested in this configuration. | |
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" | |
jobs: | |
check-version-strings: | |
runs-on: ubuntu-latest | |
container: python:3.9.18-slim-bullseye | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
pip install pyyaml | |
- name: Test versions | |
run: | | |
python testversion.py | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
needs: [check-version-strings] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.17.0 | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
needs: [check-version-strings] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
id-token: write | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 |