Skip to content

Build wheels

Build wheels #51

Workflow file for this run

name: Build wheels
on:
workflow_dispatch:
branches:
- main
release:
types:
- published
jobs:
build_wheels:
name: Build wheel for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-11]
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
# uncomment to force a wheel build
# ref: v4.2.3
fetch-depth: 1
- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
CIBW_SKIP: pp*
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"
CIBW_ARCHS_WINDOWS: "AMD64 x86"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_BUILD_VERBOSITY: 2
- name: Save wheels
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install pypa/build
run: pip install 'build[virtualenv]'
- name: Build sdist
run: python -m build --sdist
- name: Save sdist
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload_all:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.8.5
with:
user: __token__
password: ${{ secrets.pypi_token }}