Build and upload wheels #17
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 upload wheels | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+\.[0-9]+\.[0-9]+' | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Build sdist | |
| run: uv build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist-artifact | |
| path: dist/*.tar.gz | |
| if-no-files-found: error | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.11.2 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel-artifact-${{ matrix.os }} | |
| path: ./wheelhouse/*.whl | |
| if-no-files-found: error | |
| upload_pypi: | |
| needs: [build_wheels, build_sdist] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@v1.5.0 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} |