Skip to content

Publish to PyPI

Publish to PyPI #17

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [ created ]
jobs:
build-wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-14 ]
architecture: [ x86-64, aarch64 ]
python-version: [ '3.10']
exclude:
- os: macos-14
architecture: x86-64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.platform.python-version }}
architecture: ${{ matrix.platform.architecture }}
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
command: build
target: ${{ matrix.platform.architecture }}
args: >
--release
--out dist
--find-interpreter
-i python${{ matrix.python-version }}
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.platform.architecture }}
path: dist/*.whl
release:
runs-on: ubuntu-latest
# Specifying a GitHub environment is optional, but strongly encouraged
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for Trusted Publishing
id-token: write
needs: [build-wheels]
steps:
- uses: actions/download-artifact@v4
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-path: 'wheels-*/*'
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1