Build and Publish Release #121
This file contains hidden or 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 | |
| jobs: | |
| build_x86_manylinux_wheels: | |
| name: Build x86 manylinux wheels on Linux | |
| runs-on: ubuntu-latest | |
| env: | |
| CIBW_SKIP: '*-musllinux* pp38-* pp311-* cp38-* cp314t-*' | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| - 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: '*-manylinux* pp38-* pp311-* cp38-* cp314t-*' | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| - 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: '*-musllinux* cp38-* cp314t-*' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| - 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: '*-manylinux* cp38-* cp314t-*' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| - 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: 'pp39-* pp310-*' | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| - 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 | |
| env: | |
| CIBW_ARCHS_MACOS: x86_64 arm64 | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| CIBW_SKIP: 'pp38-* pp311-* cp38-* cp314t-*' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| 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 | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| CIBW_SKIP: 'pp38-* pp311-* cp38-* cp314t-*' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| - 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: Set up Python (3.12) | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| - name: Install Dependencies | |
| run: | | |
| pip install twine | |
| pip install -U setuptools | |
| - 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: 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/* |