Build wheels, sdist, and upload to PyPI (only on release!) #41
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 wheels, sdist, and upload to PyPI (only on release!) | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "rc-v*.*.*" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-13] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Used to host cibuildwheel | |
| - name: Build wheel | |
| uses: pypa/cibuildwheel@v3.0.1 | |
| with: | |
| output-dir: wheelhouse | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cibw-wheels-${{ matrix.os }} | |
| path: ./wheelhouse/*.whl | |
| make_sdist: | |
| name: Make source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install libsemigroups | |
| run: sudo etc/install-libsemigroups.sh | |
| - name: Build SDist | |
| run: pipx run build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| upload: | |
| if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }} | |
| needs: | |
| - build_wheels | |
| - make_sdist | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/libsemigroups-pybind11/ | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download wheels and sdist artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| # Here, we could specify a name of an artifact, or a pattern that | |
| # matches the names of artifacts. However, by not specifying these | |
| # values, all of the artifacts from this run are downloaded (which is | |
| # what we want). | |
| # Destination path | |
| path: dist | |
| # If true, the downloaded artifacts will be in the same directory | |
| # specified by path. | |
| # If false, the downloaded artifacts will be extracted into individual | |
| # named directories within the specified path.' | |
| merge-multiple: true | |
| - name: List directory contents | |
| run: ls dist | |
| # - name: Publish distribution to PyPI | |
| # uses: pypa/gh-action-pypi-publish@release/v1 |