Build and upload to PyPI #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and upload to PyPI | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# macos-13 is an intel runner, macos-14 is apple silicon | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install dependencies for Windows | |
if: runner.os == 'Windows' | |
run: | | |
New-Item -Path "C:\Program Files\" -Name "boost" -ItemType "directory" | |
Invoke-WebRequest -Uri https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip -OutFile "C:\Program Files\boost\boost_1_82_0.zip" | |
7z x -o"C:\Program Files\boost\" "C:\Program Files\boost\boost_1_82_0.zip" | |
- name: Install dependencies for Mac | |
if: runner.os == 'macOS' | |
run: | | |
brew update | |
brew install boost | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
BUILD_EXTENSION: yes | |
CIBW_SKIP: "pp* *-win32 *-musllinux_x86_64 *_i686" | |
CIBW_BEFORE_ALL_LINUX: yum install -y boost-devel | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
make_sdist: | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build SDist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
upload_all: | |
needs: [build_wheels, make_sdist] | |
environment: pypi | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |