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
| name: Create library release archives, create a GH release and publish PyPI wheel and sdist on tag in main branch | |
| # This is executed automatically on a tag in the main branch | |
| # Summary of the steps: | |
| # - build wheels and sdist | |
| # - upload wheels and sdist to PyPI | |
| # - create gh-release and upload wheels and dists there | |
| # TODO: smoke test wheels and sdist | |
| # TODO: add changelog to release text body | |
| # WARNING: this is designed only for packages building as pure Python wheels | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| build-pypi-distribs-sdist: | |
| name: Build and upload sdist | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install build, twine, pkginfo, and packaging | |
| run: python -m pip install --user --upgrade build twine pkginfo packaging | |
| - name: Build sdist | |
| run: python -m build --sdist --outdir dist/ | |
| - name: Validate sdist for Pypi | |
| run: python -m twine check dist/* | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pypi_archives-sdist | |
| path: dist/* | |
| build-pypi-distribs-wheels: | |
| name: Build and upload wheels | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-13, macos-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install cibuildwheel, twine, pkginfo, and packaging | |
| run: python -m pip install --user --upgrade cibuildwheel twine pkginfo packaging | |
| - name: Build wheels | |
| env: | |
| CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*" | |
| CIBW_SKIP: "*_aarch64 *_ppc64le *_s390x *_armv7l *_riscv64 *_aarch64 *_ppc64le *_s390x *_armv7l *_riscv64" | |
| run: python -m cibuildwheel --output-dir dist/ | |
| - name: Validate wheels for Pypi | |
| run: python -m twine check dist/* | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pypi_archives-${{ matrix.os }} | |
| path: dist/* | |
| create-gh-release: | |
| name: Create GH release | |
| needs: | |
| - build-pypi-distribs-sdist | |
| - build-pypi-distribs-wheels | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Download sdist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-sdist | |
| path: dist | |
| - name: Download ubuntu-latest builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-ubuntu-latest | |
| path: dist | |
| - name: Download windows-latest builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-windows-latest | |
| path: dist | |
| - name: Download macos-13 builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-macos-13 | |
| path: dist | |
| - name: Download macos-latest builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-macos-latest | |
| path: dist | |
| - name: Create GH release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| files: dist/* | |
| create-pypi-release: | |
| name: Create PyPI release | |
| needs: | |
| - create-gh-release | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Download ubuntu-latest builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-ubuntu-latest | |
| path: dist | |
| - name: Download windows-latest builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-windows-latest | |
| path: dist | |
| - name: Download macos-13 builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-macos-13 | |
| path: dist | |
| - name: Download macos-latest builds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_archives-macos-latest | |
| path: dist | |
| - name: Publish to PyPI | |
| if: startsWith(github.ref, 'refs/tags') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} |