-
Notifications
You must be signed in to change notification settings - Fork 5
68 lines (64 loc) · 2.31 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: CD
on:
push:
branches: [main]
release:
types: [published]
workflow_dispatch:
permissions:
attestations: write
contents: read
id-token: write
jobs:
# Builds the sdist and wheels on all supported platforms and uploads the resulting
# wheels as GitHub artifacts `dev-cibw-*`, `test-cibw-*`, or `cibw-*`, depending on
# whether the workflow is triggered from a PR, a push to main, or a release, respectively.
python-packaging:
name: 🐍 Packaging
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.4
with:
# Do not include local version information on pushes to main to facilitate TestPyPI uploads.
no-local-version: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
# Do not build emulated wheels on pushes to main to reduce runner load for CD.
build-emulated-wheels: ${{ github.ref != 'refs/heads/main' || github.event_name != 'push' }}
# Downloads the previously generated artifacts and deploys to TestPyPI on pushes to main
deploy-test-pypi:
name: 🚀 Deploy to Test PyPI
runs-on: ubuntu-latest
environment:
name: test-pypi
url: https://test.pypi.org/p/mqt.qudits
needs: [python-packaging]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/download-artifact@v4
with:
pattern: test-cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
attestations: true
# Downloads the previously generated artifacts and deploys to PyPI on published releases.
deploy:
if: github.event_name == 'release' && github.event.action == 'published'
name: 🚀 Deploy to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/mqt.qudits
needs: [python-packaging]
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Generate artifact attestation for sdist and wheel(s)
uses: actions/attest-build-provenance@v1.4.3
with:
subject-path: "dist/*"
- uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true