chore(deps-rs): bump the patch group with 3 updates (#548) #36
This file contains 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: Pure Python wheels 🐍 | |
# Builds and publishes the pure wheels on pypi. | |
# | |
# This does not include the main `tket2-py` package, which is built using maturin. | |
# See `python-wheels.yml` for that workflow. | |
# | |
# When running on a release event or as a workflow dispatch for a tag, | |
# and if the tag matches `{package}-v*`, | |
# this workflow will publish the wheels to pypi. | |
# If the version is already published, pypi just ignores it. | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
jobs: | |
build-publish: | |
name: Package and publish wheels | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- { name: tket2-eccs, key_secret: PYPI_PUBLISH_TKET2_ECCS } | |
steps: | |
# Check the release tag against the package name | |
# | |
# Skip the workflow when triggered by a release event for any other package. | |
- name: Check tag | |
id: check-tag | |
run: | | |
echo "run=$SHOULD_RUN" >> $GITHUB_OUTPUT | |
env: | |
SHOULD_RUN: ${{ github.event_name != 'release' || ( github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{0}-v', matrix.target.name)) ) }} | |
- uses: actions/checkout@v4 | |
if: ${{ steps.check-tag.outputs.run == 'true' }} | |
- name: Run sccache-cache | |
if: ${{ steps.check-tag.outputs.run == 'true' }} | |
uses: mozilla-actions/[email protected] | |
- name: Install poetry | |
if: ${{ steps.check-tag.outputs.run == 'true' }} | |
run: pipx install poetry | |
- name: Set up Python '3.10' | |
if: ${{ steps.check-tag.outputs.run == 'true' }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: "poetry" | |
- name: Build sdist and wheels | |
if: ${{ steps.check-tag.outputs.run == 'true' }} | |
run: | | |
cd ${{ matrix.target.name }} | |
poetry build -o ../dist | |
- name: Upload the built packages as artifacts | |
if: ${{ steps.check-tag.outputs.run == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.target.name }}-sdist | |
path: | | |
dist/*.tar.gz | |
dist/*.whl | |
- name: Publish to PyPI | |
if: ${{ (github.event_name == 'release' && github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{0}-v', matrix.target.name)) ) || (github.event_name == 'workflow_dispatch' && github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{0}-v', matrix.target.name)) ) }} | |
run: | | |
cd ${{ matrix.target.name }} | |
poetry config pypi-token.pypi ${{ secrets[matrix.target.key_secret] }} | |
poetry publish --dist-dir ../dist --skip-existing |