-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (54 loc) · 1.53 KB
/
release_pypi.yaml
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
name: Publish release to PyPI
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
ref:
type: string
description: Ref to checkout
required: true
env:
# make sure the poetry creates the venv inside the workspace under .venv
POETRY_VIRTUALENVS_IN_PROJECT: true
jobs:
build-release:
name: Publish from release
if: github.event_name == 'release'
uses: qua-platform/quam/.github/workflows/reusable-build.yaml@main
build-manually:
name: Publish from manual trigger
if: github.event_name == 'workflow_dispatch'
uses: qua-platform/quam/.github/workflows/reusable-build.yaml@main
with:
ref: ${{inputs.ref}}
release:
name: Release package to PyPi
runs-on: ubuntu-latest
needs:
- build-release
- build-manually
if: | # TODO: remove when only release trigger be kept
always()
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
permissions:
id-token: write
contents: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# This is necessary so that we have the tags.
fetch-depth: 0
ref: ${{inputs.ref}}
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
pattern: python-package-*
- name: Publish distribution to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}