0.19.8 #7
Workflow file for this run
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: Publish PyPI | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: Publish the built distributions to PyPI | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| linux: | |
| name: Linux wheels (${{ matrix.platform.name }}) | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: manylinux-x86_64 | |
| target: x86_64-unknown-linux-gnu | |
| manylinux: "2014" | |
| artifact_name: dist-manylinux-x86_64 | |
| - name: manylinux-aarch64 | |
| target: aarch64-unknown-linux-gnu | |
| manylinux: "2014" | |
| artifact_name: dist-manylinux-aarch64 | |
| - name: musllinux-x86_64 | |
| target: x86_64-unknown-linux-musl | |
| manylinux: musllinux_1_2 | |
| artifact_name: dist-musllinux-x86_64 | |
| - name: musllinux-aarch64 | |
| target: aarch64-unknown-linux-musl | |
| manylinux: musllinux_1_2 | |
| artifact_name: dist-musllinux-aarch64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Build wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: v1.12.6 | |
| target: ${{ matrix.platform.target }} | |
| manylinux: ${{ matrix.platform.manylinux }} | |
| args: >- | |
| --release --locked --out dist --compatibility pypi | |
| -i python3.10 | |
| - name: Upload distribution | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ matrix.platform.artifact_name }} | |
| path: dist/* | |
| if-no-files-found: error | |
| macos: | |
| name: macOS wheels (${{ matrix.name }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| name: | |
| - x86_64 | |
| - arm64 | |
| include: | |
| - name: x86_64 | |
| runner: macos-15-intel | |
| target: x86_64-apple-darwin | |
| artifact_name: dist-macos-x86_64 | |
| - name: arm64 | |
| runner: macos-15 | |
| target: aarch64-apple-darwin | |
| artifact_name: dist-macos-arm64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Build wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: v1.12.6 | |
| target: ${{ matrix.target }} | |
| args: >- | |
| --release --locked --out dist --compatibility pypi | |
| -i python | |
| - name: Upload distribution | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: dist/* | |
| if-no-files-found: error | |
| windows: | |
| name: Windows wheels (${{ matrix.name }}) | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| name: | |
| - win_amd64 | |
| - win32 | |
| include: | |
| - name: win_amd64 | |
| runner: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| python_arch: x64 | |
| artifact_name: dist-win_amd64 | |
| - name: win32 | |
| runner: windows-latest | |
| target: i686-pc-windows-msvc | |
| python_arch: x86 | |
| artifact_name: dist-win32 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| architecture: ${{ matrix.python_arch }} | |
| - name: Build wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: v1.12.6 | |
| target: ${{ matrix.target }} | |
| args: >- | |
| --release --locked --out dist --compatibility pypi | |
| -i python | |
| - name: Upload distribution | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: dist/* | |
| if-no-files-found: error | |
| sdist: | |
| name: Source distribution | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: v1.12.6 | |
| command: sdist | |
| args: --out dist | |
| - name: Upload distribution | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: dist-sdist | |
| path: dist/* | |
| if-no-files-found: error | |
| publish: | |
| name: Publish to PyPI | |
| environment: publish | |
| runs-on: ubuntu-22.04 | |
| needs: [linux, macos, windows, sdist] | |
| if: >- | |
| ${{ | |
| startsWith(github.ref, 'refs/tags/') | |
| || (github.event_name == 'workflow_dispatch' && inputs.publish) | |
| }} | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: dist-* | |
| merge-multiple: true | |
| path: dist | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install twine | |
| run: python -m pip install --disable-pip-version-check --upgrade twine | |
| - name: Publish distributions | |
| shell: bash | |
| run: | | |
| token="${PYPI_TOKEN:-$PYPI_TOKEN_FROM_SECRET}" | |
| if [ -z "$token" ]; then | |
| echo "PYPI_TOKEN is not set" | |
| exit 1 | |
| fi | |
| export TWINE_USERNAME=__token__ | |
| export TWINE_PASSWORD="$token" | |
| python -m twine upload dist/* | |
| env: | |
| PYPI_TOKEN_FROM_SECRET: ${{ secrets.PYPI_TOKEN }} |