Skip to content

Build wheels for Linux/macOS, build sdist, and publish to PyPI #1

Build wheels for Linux/macOS, build sdist, and publish to PyPI

Build wheels for Linux/macOS, build sdist, and publish to PyPI #1

name: Build wheels for Linux/macOS, build sdist, and publish to PyPI
on:
release:
types: published
jobs:
build_wheels:
name: Build ${{ matrix.os }} wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
env:
CIBW_ARCHS_LINUX: x86_64 aarch64
CIBW_ARCHS_MACOS: x86_64 arm64
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ runner.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
pypi-publish:
name: Publish release to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/p/pytun-pmd3
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1