Build and Publish Release #83
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 Publish Release' | |
on: | |
workflow_dispatch: | |
inputs: | |
publish_type: | |
description: Publish Type | |
type: choice | |
default: test | |
options: | |
- test | |
- release | |
- build | |
env: | |
CIBW_SKIP: 'cp36-* cp37-* pp37-*' | |
jobs: | |
build_x86_manylinux_wheels: | |
name: Build x86 manylinux wheels on Linux | |
runs-on: ubuntu-latest | |
env: | |
CIBW_SKIP: 'cp36-* cp37-* pp37-* *-musllinux*' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.21.3 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-x86-manylinux | |
path: ./wheelhouse/*.whl | |
build_x86_musllinux_wheels: | |
name: Build x86 musllinux wheels on Linux | |
runs-on: ubuntu-latest | |
env: | |
CIBW_SKIP: 'cp36-* cp37-* pp37-* *-manylinux*' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.21.3 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-x86-musllinux | |
path: ./wheelhouse/*.whl | |
build_aarch64_manylinux_wheels: | |
name: Build aarch64 manylinux wheels | |
runs-on: ubuntu-latest | |
env: | |
CIBW_ARCHS_LINUX: aarch64 | |
CIBW_SKIP: 'cp36-* cp37-* pp* *-musllinux*' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.21.3 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-aarch64-manylinux | |
path: ./wheelhouse/*.whl | |
build_aarch64_musllinux_wheels: | |
name: Build aarch64 musllinux wheels | |
runs-on: ubuntu-latest | |
env: | |
CIBW_ARCHS_LINUX: aarch64 | |
CIBW_SKIP: 'cp36-* cp37-* pp* *-manylinux*' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.21.3 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-aarch64-musllinux | |
path: ./wheelhouse/*.whl | |
build_aarch64_pypy_wheels: | |
name: Build aarch64 PyPy wheels | |
runs-on: ubuntu-latest | |
env: | |
CIBW_ARCHS_LINUX: aarch64 | |
CIBW_BUILD: 'pp*' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.21.3 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-aarch64-pypy | |
path: ./wheelhouse/*.whl | |
build_macos_wheels: | |
name: Build wheels on macos | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.21.3 | |
env: | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-macos | |
path: ./wheelhouse/*.whl | |
build_windows_wheels: | |
name: Build wheels on Windows | |
runs-on: windows-latest | |
env: | |
CIBW_BUILD_VERBOSITY: 2 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.21.3 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-windows | |
path: ./wheelhouse/*.whl | |
publish: | |
needs: | |
- build_macos_wheels | |
- build_windows_wheels | |
- build_x86_musllinux_wheels | |
- build_x86_manylinux_wheels | |
- build_aarch64_musllinux_wheels | |
- build_aarch64_manylinux_wheels | |
- build_aarch64_pypy_wheels | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
if: ${{ inputs.publish_type != 'build' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build source distribution | |
run: | | |
rm -rf dist | |
python setup.py sdist | |
- name: Retrieve wheels | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: build-* | |
merge-multiple: true | |
path: wheelhouse | |
- name: move and list artifacts | |
run: | | |
cp -R wheelhouse/*.whl dist | |
ls -R dist | |
- name: Install Twine | |
run: pip install twine | |
- name: Publish (Release) | |
if: ${{ inputs.publish_type == 'release' }} | |
env: | |
TWINE_USERNAME: '__token__' | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: twine upload dist/* | |
- name: Publish (Test) | |
if: ${{ inputs.publish_type == 'test' }} | |
env: | |
TWINE_USERNAME: '__token__' | |
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }} | |
run: twine upload --repository testpypi dist/* |