Skip to content

V0.6.2 -V 0.8.0 (-#39) #8

V0.6.2 -V 0.8.0 (-#39)

V0.6.2 -V 0.8.0 (-#39) #8

Workflow file for this run

name: Release PyPI
on:
push:
tags:
- 'pypi/v*'
permissions:
contents: read
id-token: write
jobs:
verify-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Extract version from tag
id: extract
run: |
TAG="${GITHUB_REF#refs/tags/pypi/v}"
echo "version=$TAG" >> $GITHUB_OUTPUT
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Check pyproject.toml version matches tag
run: |
pip install toml
PKG_VERSION=$(python -c "import toml; print(toml.load('jacspy/pyproject.toml')['project']['version'])")
TAG_VERSION="${{ steps.extract.outputs.version }}"
echo "Package version: $PKG_VERSION"
echo "Tag version: $TAG_VERSION"
if [ "$PKG_VERSION" = "$TAG_VERSION" ]; then
echo "Version match confirmed"
else
echo "::error::Version mismatch! pyproject.toml has $PKG_VERSION but tag is $TAG_VERSION"
exit 1
fi
build-wheels:
needs: verify-version
continue-on-error: ${{ matrix.allow_failure }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use_zig: false
allow_failure: false
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
use_zig: true
allow_failure: false
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
use_zig: false
allow_failure: false
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
use_zig: false
allow_failure: true
- os: macos-latest
target: aarch64-apple-darwin
use_zig: false
allow_failure: false
- os: macos-14
target: x86_64-apple-darwin
use_zig: false
allow_failure: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: '1.93'
target: ${{ matrix.target }}
- name: Install musl toolchain
if: contains(matrix.target, 'musl') && !matrix.use_zig
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Set musl CC for native ARM builds
if: contains(matrix.target, 'aarch64') && contains(matrix.target, 'musl') && !matrix.use_zig
run: |
echo "CC_aarch64_unknown_linux_musl=musl-gcc" >> $GITHUB_ENV
echo "AR_aarch64_unknown_linux_musl=ar" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc" >> $GITHUB_ENV
- name: Install maturin
if: ${{ !matrix.use_zig }}
run: pip install maturin
- name: Install maturin with zig support
if: ${{ matrix.use_zig }}
run: pip install "maturin[zig]"
- name: Build wheel
if: ${{ !matrix.use_zig }}
working-directory: jacspy
run: maturin build --release --target ${{ matrix.target }} --out dist
- name: Build wheel (zig)
if: ${{ matrix.use_zig }}
working-directory: jacspy
run: maturin build --release --target ${{ matrix.target }} --out dist --zig
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.target }}
path: jacspy/dist/*.whl
build-sdist:
needs: verify-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install maturin
run: pip install maturin
- name: Build sdist
working-directory: jacspy
run: maturin sdist --out dist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: jacspy/dist/*.tar.gz
publish:
needs: [build-wheels, build-sdist]
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
password: ${{ secrets.PYPI_API_TOKEN }}