name: Python Release
on:
workflow_call:
inputs:
tag:
required: true
type: string
workflow_dispatch:
inputs:
tag:
required: true
type: string
jobs:
build-wheels:
name: Build wheel (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
build_args: --release --manylinux 2014 --out dist
- os: ubuntu-24.04-arm
build_args: --release --manylinux 2014 --out dist
- os: macos-14
build_args: --release --target universal2-apple-darwin --out dist
- os: windows-latest
build_args: --release --out dist
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install maturin
run: pip install "maturin>=1.5"
- name: Build wheel (workaround for maturin workspace uniffi-bindgen bug)
working-directory: minigraf-ffi/python
run: bash build.sh build ${{ matrix.build_args }}
shell: bash
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: python-wheel-${{ matrix.os }}
path: minigraf-ffi/python/dist/*.whl
publish:
name: Publish to PyPI
needs: build-wheels
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/minigraf
permissions:
id-token: write
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: python-wheel-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/