diff --git a/.github/workflows/python-wheels.yml b/.github/workflows/python-wheels.yml index 7a608dda2..118473db6 100644 --- a/.github/workflows/python-wheels.yml +++ b/.github/workflows/python-wheels.yml @@ -11,55 +11,58 @@ on: - '*' jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + build: + name: Build source distribution + runs-on: ubuntu-latest strategy: matrix: - # macos-13 is an intel runner, macos-14 is apple silicon - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + package: + # This should be the same list as in `jobs.upload_pypi`. + - 'quantinuum-hugr-py' steps: - uses: actions/checkout@v4 - - name: Build wheels - uses: pypa/cibuildwheel@v2.17.0 + - name: Build sdist and wheels + run: | + mkdir -p dist + pipx run build ${{ matrix.package }} --outdir dist - uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} - path: ./wheelhouse/*.whl - - build_sdist: - name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Build sdist - run: pipx run build --sdist + name: build-${{ matrix.package }}-sdist + path: dist/*.tar.gz - uses: actions/upload-artifact@v4 with: - name: cibw-sdist - path: dist/*.tar.gz + name: build-${{ matrix.package }}-wheel + path: dist/*.whl upload_pypi: - needs: [build_wheels, build_sdist] + needs: [build] runs-on: ubuntu-latest environment: pypi permissions: id-token: write - if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/py-v') + if: github.event_name == 'push' && github.ref_type == 'tag' + strategy: + matrix: + package: + # This should be the same list as in `jobs.build`. + - 'quantinuum-hugr-py' + steps: - - uses: actions/download-artifact@v4 + - 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: cibw-* + pattern: build-${{ matrix.package }}-* path: dist merge-multiple: true - uses: pypa/gh-action-pypi-publish@release/v1 + if: startsWith(github.ref, 'refs/tags/${{ matrix.package }}-v') with: # TODO: Using a test endpoint repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 89d73fa15..35e1c5609 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -3,10 +3,11 @@ name: Release-please 🐍 on: workflow_dispatch: {} - push: - branches: - - main - - ci/python-ci + # TODO: Re-enable + #push: + # branches: + # - main + # - ci/python-ci permissions: contents: write @@ -17,7 +18,7 @@ jobs: name: Create release PR runs-on: ubuntu-latest steps: - - uses: google-github-actions/release-please-action@v4 + - uses: google-github-actions/release-please-action@v4.1 with: #path: "quantinuum-hugr-py" token: ${{ secrets.GITHUB_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 02f5b32b2..7667f6108 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,7 @@ name = "hugr-project" version = "0.0.0" authors = ["TKET development team "] readme = "README.md" -packages = [] - +packages = [{ include = "quantunuum_hugr", from = "quantunuum-hugr-py" }] package-mode = false [tool.poetry.group.main.dependencies]