fix: release artifacts and verify them more #982
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: Python Wheels | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| IROH_FORCE_STAGING_RELAYS: "1" | |
| jobs: | |
| manylinux: | |
| runs-on: ${{ matrix.runner }} | |
| container: ${{ matrix.container }} | |
| strategy: | |
| matrix: | |
| name: [ubuntu-latest, ubuntu-arm-latest] | |
| include: | |
| - name: ubuntu-latest | |
| release-os: manylinux_2_28 | |
| release-arch: x86_64 | |
| container: quay.io/pypa/manylinux_2_28_x86_64 | |
| runner: [self-hosted, linux, X64] | |
| - name: ubuntu-arm-latest | |
| release-os: manylinux_2_28 | |
| release-arch: aarch64 | |
| container: quay.io/pypa/manylinux_2_28_aarch64 | |
| runner: [self-hosted, linux, ARM64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install rust + cargo-make | |
| run: | | |
| curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal | |
| source $HOME/.cargo/env | |
| cargo install cargo-make | |
| - name: Install maturin & uniffi-bindgen | |
| run: /opt/python/cp311-cp311/bin/pip install -U maturin uniffi-bindgen | |
| - name: cargo make python-wheel-manylinux | |
| run: | | |
| source $HOME/.cargo/env | |
| export PATH=/opt/python/cp311-cp311/bin:$PATH | |
| cargo make python-wheel-manylinux | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.release-os }}-${{ matrix.release-arch }} | |
| path: target/wheels/*.whl | |
| osx: | |
| # arm64-only: the org has no GitHub-hosted macOS and x86_64 mac wheels | |
| # were dropped. | |
| runs-on: [self-hosted, macOS, ARM64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-darwin | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - run: pip install -U maturin uniffi-bindgen | |
| - name: maturin build | |
| run: maturin build --release --target aarch64-apple-darwin | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-darwin-aarch64 | |
| path: target/wheels/*.whl | |
| windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: davidB/rust-cargo-make@v1 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - run: pip install -U maturin uniffi-bindgen | |
| - name: cargo make python-wheel | |
| run: cargo make python-wheel | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-windows-x86_64 | |
| path: target/wheels/*.whl | |
| publish: | |
| name: Publish wheels to PyPI | |
| needs: [manylinux, osx, windows] | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') | |
| runs-on: [self-hosted, linux, X64] | |
| # Trusted Publishing (OIDC) — no long-lived PyPI token needed. Requires | |
| # the publisher to be registered once at | |
| # https://pypi.org/manage/account/publishing/ (project: iroh, | |
| # owner: n0-computer, repo: iroh-ffi, workflow: wheels.yml). | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| path: dist/ | |
| merge-multiple: true | |
| - run: ls -la dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true |