Skip to content

fix: PyPy release

fix: PyPy release #57

name: Build & Publish
on:
pull_request:
paths:
- ".github/workflows/build-and-publish.yml"
- "setup.*"
workflow_dispatch:
inputs:
branch:
description: "The branch, tag or SHA to release from"
required: true
default: "master"
jobs:
os-built-distributions:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build dependencies
run: python -m pip install --upgrade cibuildwheel
- name: Build wheels
run: python -m cibuildwheel
env:
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_ARCHS_LINUX: "auto aarch64"
- uses: actions/upload-artifact@v4
with:
name: python-package-distributions-${{ matrix.os }}
path: ./wheelhouse/*.whl
source-distribution:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build source distribution
run: |
# setuptools was removed starting with Python 3.12
pip install --upgrade --force setuptools
python setup.py sdist
- name: Store the source distribution
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-source
path: dist
retention-days: 4
publish:
needs:
- os-built-distributions
- source-distribution
runs-on: ubuntu-latest
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
pattern: python-package-distributions-*
merge-multiple: true
path: dist/
- name: What will we publish?
run: ls -l dist
- name: Publish
if: github.event.inputs.branch != ''
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true