Always try pushing to pypy test #6
Workflow file for this run
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: Build and publish python wheels | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
- ci/python-ci | |
tags: | |
- '*' | |
jobs: | |
build: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: | |
# This should be the same list as in `jobs.upload_pypi`. | |
- 'quantinuum-hugr-py' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist and wheels | |
run: | | |
mkdir -p dist | |
pipx run build ${{ matrix.package }} --outdir dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.package }}-sdist | |
path: dist/*.tar.gz | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.package }}-wheel | |
path: dist/*.whl | |
upload_pypi: | |
needs: [build] | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
id-token: write | |
strategy: | |
matrix: | |
package: | |
# This should be the same list as in `jobs.build`. | |
- 'quantinuum-hugr-py' | |
steps: | |
- name: Download artifacts | |
if: startsWith(github.ref, 'refs/tags/${{ matrix.package }}-v') | |
uses: actions/download-artifact@v4 | |
with: | |
# unpacks all CIBW artifacts into dist/ | |
pattern: build-${{ matrix.package }}-* | |
path: dist | |
merge-multiple: true | |
- name: Publish to test instance of PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.event_name != 'push' || github.ref_type != 'tag' || | |
not(startsWith(github.ref, 'refs/tags/${{ matrix.package }}-v')) | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.event_name == 'push' && github.ref_type == 'tag' && | |
startsWith(github.ref, 'refs/tags/${{ matrix.package }}-v') | |
with: | |
# TODO: Use the real PyPI URL | |
repository-url: https://test.pypi.org/legacy/ |