feat(release): add PyPI publish workflow #2
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 to PyPI | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| build-wheels: | |
| name: Build wheels (${{ matrix.platform }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| platform: manylinux_x86_64 | |
| target: x86_64-unknown-linux-gnu | |
| - os: ubuntu-22.04 | |
| platform: manylinux_aarch64 | |
| target: aarch64-unknown-linux-gnu | |
| cflags_aarch64: "-march=armv8-a -D__ARM_ARCH=8" | |
| - os: macos-13 | |
| platform: macos_x86_64 | |
| target: x86_64-apple-darwin | |
| - os: macos-14 | |
| platform: macos_aarch64 | |
| target: aarch64-apple-darwin | |
| - os: windows-2022 | |
| platform: windows_x86_64 | |
| target: x86_64-pc-windows-msvc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Set ring flags (linux aarch64) | |
| if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' && startsWith(matrix.platform, 'manylinux') }} | |
| run: | | |
| echo "CFLAGS_aarch64_unknown_linux_gnu=${{ matrix.cflags_aarch64 }}" >> $GITHUB_ENV | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: build | |
| args: --release --out dist -F python-ffi | |
| maturin-version: "1.5.1" | |
| manylinux: auto | |
| target: ${{ matrix.target }} | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.platform }} | |
| path: dist/*.whl | |
| sdist: | |
| name: Build sdist | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist -F python-ffi | |
| maturin-version: "1.5.1" | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| publish: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-22.04 | |
| needs: [build-wheels, sdist] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "wheels-*" | |
| path: dist | |
| merge-multiple: true | |
| - name: Download sdist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist | |
| - name: Publish | |
| uses: PyO3/maturin-action@v1 | |
| env: | |
| MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
| with: | |
| command: upload | |
| args: --non-interactive --skip-existing dist/* | |
| maturin-version: "1.5.1" |