Publish tagged releases to PyPI via Trusted Publishing (#7) #58
Workflow file for this run
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
| on: [push, pull_request] | |
| name: build | |
| jobs: | |
| wheels-linux: | |
| name: Wheels for Linux | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.11 | |
| architecture: x64 | |
| # - name: Login to Docker Hub | |
| # uses: docker/login-action@v1 | |
| # with: | |
| # username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Install cibuildwheel | |
| run: | | |
| pip install --upgrade pip setuptools | |
| pip install cython cibuildwheel==$VERSION | |
| env: | |
| VERSION: 3.2.1 | |
| - name: Build wheels | |
| run: cibuildwheel --output-dir wheelhouse | |
| env: | |
| CIBW_BUILD: 'cp3{9,10,11,12,13,14}-* pp3{9,10,11}-*' | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| - uses: ncipollo/release-action@v1 | |
| name: Upload wheels | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| artifacts: "wheelhouse/*" | |
| allowUpdates: true | |
| draft: true | |
| tag: Linux | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@v4 | |
| name: Store wheels | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| name: dist-linux | |
| path: wheelhouse/*.whl | |
| wheels-macos: | |
| name: Wheels for OS X | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.11 | |
| architecture: x64 | |
| # - name: Login to Docker Hub | |
| # uses: docker/login-action@v1 | |
| # with: | |
| # username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Install cibuildwheel | |
| run: | | |
| pip install --upgrade pip setuptools | |
| pip install cython cibuildwheel==$VERSION | |
| env: | |
| VERSION: 3.2.1 | |
| - name: Build wheels | |
| run: cibuildwheel --output-dir wheelhouse | |
| env: | |
| CIBW_BUILD: 'cp3{9,10,11,12,13,14}-* pp3{9,10,11}-*' | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| CIBW_ARCHS_MACOS: x86_64 arm64 | |
| - uses: ncipollo/release-action@v1 | |
| name: Upload wheels | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| artifacts: "wheelhouse/*" | |
| allowUpdates: true | |
| draft: true | |
| tag: OS X | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@v4 | |
| name: Store wheels | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| name: dist-macos | |
| path: wheelhouse/*.whl | |
| wheels-windows: | |
| name: Wheels for Windows | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.11 | |
| architecture: x64 | |
| # - name: Login to Docker Hub | |
| # uses: docker/login-action@v1 | |
| # with: | |
| # username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Install cibuildwheel | |
| run: | | |
| pip install cibuildwheel==$env:VERSION | |
| env: | |
| VERSION: 3.2.1 | |
| - name: Build wheels | |
| run: cibuildwheel --output-dir wheelhouse | |
| env: | |
| CIBW_BUILD: 'cp3{9,10,11,12,13,14}-* pp3{9,10,11}-*' | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| CIBW_BEFORE_BUILD: pip install cython | |
| - uses: ncipollo/release-action@v1 | |
| name: Upload wheels | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| artifacts: "wheelhouse/*" | |
| allowUpdates: true | |
| draft: true | |
| tag: Windows | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@v4 | |
| name: Store wheels | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| name: dist-windows | |
| path: wheelhouse/*.whl | |
| wheels-linux-non-x86: | |
| name: Wheels for Linux non-x86 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: | |
| - aarch64 | |
| - ppc64le | |
| - s390x | |
| steps: | |
| - uses: actions/checkout@v2.1.0 | |
| # - name: Login to Docker Hub | |
| # uses: docker/login-action@v1 | |
| # with: | |
| # username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| # password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.11 | |
| architecture: x64 | |
| - name: Set up QEMU | |
| id: qemu | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| image: tonistiigi/binfmt:qemu-v8.1.5 | |
| platforms: all | |
| - name: Install cibuildwheel | |
| run: | | |
| pip install --upgrade pip setuptools | |
| pip install cibuildwheel==$VERSION | |
| env: | |
| VERSION: 3.2.1 | |
| - name: Build wheels | |
| run: cibuildwheel --output-dir wheelhouse | |
| env: | |
| CIBW_BUILD: 'cp3{9,10,11,12,13,14}-* pp3{9,10,11}-*' | |
| CIBW_ENABLE: 'pypy pypy-eol' | |
| CIBW_ARCHS: ${{ matrix.arch }} | |
| - uses: ncipollo/release-action@v1 | |
| name: Upload wheels | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| artifacts: "wheelhouse/*" | |
| allowUpdates: true | |
| draft: true | |
| tag: Linux non-x86 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/upload-artifact@v4 | |
| name: Store wheels | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| name: dist-linux-${{ matrix.arch }} | |
| path: wheelhouse/*.whl | |
| sdist: | |
| name: Source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.11 | |
| - name: Build sdist | |
| run: | | |
| pip install --upgrade pip build | |
| python -m build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| name: Store sdist | |
| if: ${{ github.ref_type == 'tag' }} | |
| with: | |
| name: dist-sdist | |
| path: dist/*.tar.gz | |
| publish-pypi: | |
| name: Publish to PyPI | |
| if: ${{ github.ref_type == 'tag' }} | |
| needs: | |
| - sdist | |
| - wheels-linux | |
| - wheels-macos | |
| - wheels-windows | |
| - wheels-linux-non-x86 | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: dist-* | |
| merge-multiple: true | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |