name: Python publish (manual)
on:
workflow_dispatch:
inputs:
publish-crate:
description: "Also publish Rust crate to crates.io"
required: false
default: "false"
type: choice
options: ["false", "true"]
jobs:
publish-crate:
if: ${{ inputs.publish-crate == 'true' }}
name: Publish crate to crates.io (manual)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.89.0
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
pypi-manylinux-x86_64:
name: PyPI manylinux (x86_64) + sdist (manual)
runs-on: ubuntu-latest
needs: []
steps:
- uses: actions/checkout@v4
- name: Build wheel (manylinux x86_64 + sdist)
uses: messense/maturin-action@v1
with:
target: x86_64-unknown-linux-gnu
command: build
args: --release --zig
manylinux: "2_17"
container: off
- name: Upload wheels to PyPI (manylinux x86_64 + sdist)
uses: pypa/gh-action-pypi-publish@v1.10.0
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: target/wheels
skip-existing: true
pypi-manylinux-aarch64:
name: PyPI manylinux (aarch64) (manual)
runs-on: ubuntu-24.04-arm
needs: []
steps:
- uses: actions/checkout@v4
- name: Build wheel (manylinux aarch64)
uses: messense/maturin-action@v1
with:
target: aarch64-unknown-linux-gnu
command: build
args: --release --no-sdist --zig
manylinux: "2_28"
container: off
- name: Upload wheels to PyPI (manylinux aarch64)
uses: pypa/gh-action-pypi-publish@v1.10.0
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: target/wheels
skip-existing: true
pypi-musllinux-x86_64:
name: PyPI musllinux (x86_64, musl 1.2+) (manual)
runs-on: ubuntu-latest
needs: []
steps:
- uses: actions/checkout@v4
- name: Build wheel (musllinux x86_64)
uses: messense/maturin-action@v1
with:
target: x86_64-unknown-linux-musl
command: build
args: --release --no-sdist --zig --compatibility musllinux_1_2
- name: Upload wheels to PyPI (musllinux x86_64)
uses: pypa/gh-action-pypi-publish@v1.10.0
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: target/wheels
skip-existing: true
pypi-musllinux-aarch64:
name: PyPI musllinux (aarch64, musl 1.2+) (manual)
runs-on: ubuntu-24.04-arm
needs: []
steps:
- uses: actions/checkout@v4
- name: Build wheel (musllinux aarch64)
uses: messense/maturin-action@v1
with:
target: aarch64-unknown-linux-musl
command: build
args: --release --no-sdist --zig --compatibility musllinux_1_2
- name: Upload wheels to PyPI (musllinux aarch64)
uses: pypa/gh-action-pypi-publish@v1.10.0
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: target/wheels
skip-existing: true
pypi-mac:
name: PyPI macOS (${{ matrix.target }}) (manual)
runs-on: macos-14
strategy:
fail-fast: false
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
steps:
- uses: actions/checkout@v4
- name: Build wheel (macOS)
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
command: build
args: --release --no-sdist
- name: Upload wheels to PyPI (macOS)
uses: pypa/gh-action-pypi-publish@v1.10.0
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: target/wheels
skip-existing: true