name: Release to TestPyPI
on:
push:
tags:
- "v*"
jobs:
build_wheels:
name: Build wheels on ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build wheels via Maturin Docker
run: |
docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin \
build --release --manylinux 2014 \
--interpreter python${{ matrix.python-version }}
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.python-version }}
path: target/wheels/*.whl
publish:
name: Publish with Twine to TestPyPI
runs-on: ubuntu-latest
needs: build_wheels
environment: env
permissions:
contents: read
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Set up Python (for twine)
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install twine
run: python -m pip install --upgrade pip twine
- name: Upload to TestPyPI with twine
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TOKEN}}
run: |
python -m twine upload \
--repository-url https://test.pypi.org/legacy/ \
--skip-existing \
--verbose \
dist/*.whl