Skip to content

feat: Render function names in mermaid/dot (#1583) #481

feat: Render function names in mermaid/dot (#1583)

feat: Render function names in mermaid/dot (#1583) #481

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.
on:
workflow_dispatch:
push:
branches:
- main
release:
types:
- published
jobs:
build-publish:
name: Build and publish wheels
runs-on: ubuntu-latest
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@v3
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 }}"
uvx twine upload --skip-existing --verbose dist/*
env:
TWINE_NON_INTERACTIVE: 1
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PUBLISH }}