Build and publish wheels #11
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: Build and publish wheels | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| on: | |
| # Build wheels on every push to master (but don't publish) | |
| push: | |
| branches: [master] | |
| # Publish to PyPI when a release tag is pushed | |
| release: | |
| types: [published] | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| jobs: | |
| build-sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Build source distribution | |
| run: pipx run build --sdist | |
| - uses: actions/upload-artifact@v5 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| build-wheels: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-13, macos-14] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: docker/setup-qemu-action@v4 | |
| if: runner.os == 'Linux' | |
| with: | |
| platforms: arm64 | |
| - uses: pypa/cibuildwheel@v2.21 | |
| - uses: actions/upload-artifact@v5 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: wheelhouse/*.whl | |
| # Publish to PyPI only on release | |
| publish: | |
| needs: [build-sdist, build-wheels] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' | |
| environment: pypi | |
| permissions: | |
| id-token: write # for trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -lh dist/ | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |