Skip to content

chore(deps-rs): update jsonschema requirement from 0.26.0 to 0.27.0 i… #627

chore(deps-rs): update jsonschema requirement from 0.26.0 to 0.27.0 i…

chore(deps-rs): update jsonschema requirement from 0.26.0 to 0.27.0 i… #627

Workflow file for this run

name: Build and publish python wheels
# Builds and publishes the wheels on pypi.
#
# When running on a push-to-main event, or as a workflow dispatch on a branch,
# this workflow will do a dry-run publish to test-pypi.
#
# When running on a release event or as a workflow dispatch for a tag,
# and if the tag matches `hugr-py-v*`,
# this workflow will publish the wheels to pypi.
# If the version is already published, pypi just ignores it.
permissions:
# This permission is required for trusted publishing on pypi
id-token: write
on:
workflow_dispatch:
push:
branches:
- main
release:
types:
- published
jobs:
build-publish:
name: Build and publish wheels
runs-on: ubuntu-latest
environment: pypi
strategy:
matrix:
package:
- { dir: 'hugr-py', name: 'hugr' }
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
version: "0.4.18"
enable-cache: true
- name: Install Python
run: uv python install 3.13
- name: Build sdist and wheels
run: |
cd ${{ matrix.package.dir }}
uvx --from build pyproject-build --installer uv --outdir ../dist
- name: Upload the built packages as artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.package.name }}-sdist
path: |
dist/*.tar.gz
dist/*.whl
- name: Test installing the built wheels
run: |
echo "Testing the newly built ${{ matrix.package.name }} wheels..."
uv run -f dist --with ${{ matrix.package.name }} --refresh-package ${{ matrix.package.name }} --no-project -- python -c "import ${{ matrix.package.name }}"
uvx twine check --strict dist/*
- name: Publish to PyPI
if: ${{ (github.event_name == 'release' && github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{0}-v', matrix.package.dir))) || (github.event_name == 'workflow_dispatch' && github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{0}-v', matrix.package.dir))) }}
run: |
echo "Publishing to PyPI..."
echo "Based on the following workflow variables, this is a new version tag push:"
echo " - event_name: ${{ github.event_name }}"
echo " - ref_type: ${{ github.ref_type }}"
echo " - ref: ${{ github.ref }}"
- name: Publish package distributions to PyPI
# This workflow is a trusted publisher on PyPI for this package.
if: ${{ (github.event_name == 'release' && github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{0}-v', matrix.package.dir))) || (github.event_name == 'workflow_dispatch' && github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{0}-v', matrix.package.dir))) }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
skip-existing: true