|
1 | 1 | name: CD
|
2 | 2 | on:
|
| 3 | + push: |
| 4 | + branches: [main] |
3 | 5 | release:
|
4 | 6 | types: [published]
|
5 | 7 | workflow_dispatch:
|
6 |
| - pull_request: |
7 |
| - paths: |
8 |
| - - .github/workflows/cd.yml |
9 | 8 |
|
10 |
| -concurrency: |
11 |
| - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
12 |
| - cancel-in-progress: true |
| 9 | +permissions: |
| 10 | + attestations: write |
| 11 | + contents: read |
| 12 | + id-token: write |
13 | 13 |
|
14 | 14 | jobs:
|
| 15 | + # Builds the sdist and wheels on all supported platforms and uploads the resulting |
| 16 | + # wheels as GitHub artifacts `dev-cibw-*`, `test-cibw-*`, or `cibw-*`, depending on |
| 17 | + # whether the workflow is triggered from a PR, a push to main, or a release, respectively. |
15 | 18 | python-packaging:
|
16 | 19 | name: 🐍 Packaging
|
17 | 20 | uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.4
|
| 21 | + with: |
| 22 | + # Do not include local version information on pushes to main to facilitate TestPyPI uploads. |
| 23 | + no-local-version: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} |
| 24 | + # Do not build emulated wheels on pushes to main to reduce runner load for CD. |
| 25 | + build-emulated-wheels: ${{ github.ref != 'refs/heads/main' || github.event_name != 'push' }} |
18 | 26 |
|
| 27 | + # Downloads the previously generated artifacts and deploys to TestPyPI on pushes to main |
| 28 | + deploy-test-pypi: |
| 29 | + name: 🚀 Deploy to Test PyPI |
| 30 | + runs-on: ubuntu-latest |
| 31 | + environment: |
| 32 | + name: test-pypi |
| 33 | + url: https://test.pypi.org/p/mqt.qcec |
| 34 | + needs: [python-packaging] |
| 35 | + if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
| 36 | + steps: |
| 37 | + - uses: actions/download-artifact@v4 |
| 38 | + with: |
| 39 | + pattern: test-cibw-* |
| 40 | + path: dist |
| 41 | + merge-multiple: true |
| 42 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 43 | + with: |
| 44 | + repository-url: https://test.pypi.org/legacy/ |
| 45 | + attestations: true |
| 46 | + |
| 47 | + # Downloads the previously generated artifacts and deploys to PyPI on published releases. |
19 | 48 | deploy:
|
20 | 49 | if: github.event_name == 'release' && github.event.action == 'published'
|
21 | 50 | name: 🚀 Deploy to PyPI
|
22 | 51 | runs-on: ubuntu-latest
|
23 | 52 | environment:
|
24 | 53 | name: pypi
|
25 | 54 | url: https://pypi.org/p/mqt.qcec
|
26 |
| - permissions: |
27 |
| - id-token: write |
28 |
| - attestations: write |
29 |
| - contents: read |
30 | 55 | needs: [python-packaging]
|
31 | 56 | steps:
|
32 | 57 | - uses: actions/download-artifact@v4
|
|
0 commit comments