Skip to content

Build and Upload Wheels #26

Build and Upload Wheels

Build and Upload Wheels #26

name: Build and Upload Wheels
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
build_wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false #build all wheels even if one fails
matrix:
include:
- os: ubuntu-latest
python-version: "3.9"
cpython-tag: "cp39"
- os: ubuntu-latest
python-version: "3.10"
cpython-tag: "cp310"
- os: ubuntu-latest
python-version: "3.11"
cpython-tag: "cp311"
- os: macos-14 # Add macOS
python-version: "3.9"
cpython-tag: "cp39"
- os: macos-14
python-version: "3.10"
cpython-tag: "cp310"
- os: macos-latest
python-version: "3.11"
cpython-tag: "cp311"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
# Conditional step to install gettext on macOS
- name: Install gettext on macOS
if: matrix.os == 'macos-latest'
run: |
brew install gettext
brew link --force gettext
- name: Install cibuildwheel
run: |
python -m pip install --upgrade pip
pip install cibuildwheel==2.12.0
- name: Build wheels with cibuildwheel
env:
CIBW_BUILD: ${{ matrix.cpython-tag }}-*
CIBW_SKIP: pp*,jy*,cp27*,cp36*,cp37*,cp38*
run: |
cibuildwheel --output-dir wheelhouse
- name: Install Twine for Upload
run: python -m pip install twine
- name: Upload to PyPI with Twine (verbose)
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --verbose wheelhouse/*
# - name: Upload to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
# packages_dir: wheelhouse