Publish Python Package #16
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: Publish Python Package | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
name: Build wheels with cibuildwheel | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-13, macos-latest] | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" # 3.x is technically not supported by the runner as per https://github.com/actions/setup-python/blob/55aad42e4674b58b2b2fb7d8e7552402d922b4e7/src/utils.ts#L107 | |
- name: Install cibuildwheel | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install cibuildwheel | |
- name: Build wheels | |
run: | | |
cibuildwheel --output-dir dist | |
env: | |
CIBW_BUILD: cp3{9,10,11,12}-* | |
CIBW_SKIP: pp*,cp38* | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
release: | |
name: Publish to PyPI | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Upload wheels to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |