@@ -5,114 +5,120 @@ on: push
5
5
jobs :
6
6
build :
7
7
name : Build distribution 📦
8
+ # ensure the workflow is never executed on forked branches
9
+ # it would fail anyway, so we just avoid to see an error
10
+ if : ${{ github.repository == 'containers/podman-py' }}
8
11
runs-on : ubuntu-latest
9
12
10
13
steps :
11
- - uses : actions/checkout@v4
12
- - name : Set up Python
13
- uses : actions/setup-python@v5
14
- with :
15
- python-version : " 3.x"
14
+ - uses : actions/checkout@v4
15
+ - name : Set up Python
16
+ uses : actions/setup-python@v5
17
+ with :
18
+ python-version : " 3.x"
16
19
17
- - name : Install pypa/build
18
- run : >-
19
- python3 -m
20
- pip install
21
- build
22
- --user
23
- - name : Build a binary wheel and a source tarball
24
- run : python3 -m build
25
- - name : Store the distribution packages
26
- uses : actions/upload-artifact@v4
27
- with :
28
- name : python-package-distributions
29
- path : dist/
20
+ - name : Install pypa/build
21
+ run : >-
22
+ python3 -m
23
+ pip install
24
+ build
25
+ --user
26
+ - name : Build a binary wheel and a source tarball
27
+ run : python3 -m build
28
+ - name : Store the distribution packages
29
+ uses : actions/upload-artifact@v4
30
+ with :
31
+ name : python-package-distributions
32
+ path : dist/
30
33
31
34
publish-to-pypi :
32
35
name : >-
33
36
Publish Python 🐍 distribution 📦 to PyPI
34
- if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
37
+ if : startsWith(github.ref, 'refs/tags/') && github.repository == 'containers/podman-py'
35
38
needs :
36
- - build
39
+ - build
37
40
runs-on : ubuntu-latest
38
41
environment :
39
42
name : pypi
40
43
url : https://pypi.org/p/podman
41
44
permissions :
42
- id-token : write # IMPORTANT: mandatory for trusted publishing
45
+ id-token : write # IMPORTANT: mandatory for trusted publishing
43
46
44
47
steps :
45
- - name : Download all the dists
46
- uses : actions/download-artifact@v4
47
- with :
48
- name : python-package-distributions
49
- path : dist/
50
- - name : Publish distribution 📦 to PyPI
51
- uses : pypa/gh-action-pypi-publish@release/v1
48
+ - name : Download all the dists
49
+ uses : actions/download-artifact@v4
50
+ with :
51
+ name : python-package-distributions
52
+ path : dist/
53
+ - name : Publish distribution 📦 to PyPI
54
+ uses : pypa/gh-action-pypi-publish@release/v1
52
55
53
56
github-release :
54
57
name : >-
55
58
Sign the Python 🐍 distribution 📦 with Sigstore
56
59
and upload them to GitHub Release
60
+ if : github.repository == 'containers/podman-py'
57
61
needs :
58
- - publish-to-pypi
62
+ - publish-to-pypi
59
63
runs-on : ubuntu-latest
60
64
61
65
permissions :
62
- contents : write # IMPORTANT: mandatory for making GitHub Releases
63
- id-token : write # IMPORTANT: mandatory for sigstore
66
+ contents : write # IMPORTANT: mandatory for making GitHub Releases
67
+ id-token : write # IMPORTANT: mandatory for sigstore
64
68
65
69
steps :
66
- - name : Download all the dists
67
- uses : actions/download-artifact@v4
68
- with :
69
- name : python-package-distributions
70
- path : dist/
71
- - name : Sign the dists with Sigstore
72
-
73
- with :
74
- inputs : >-
75
- ./dist/*.tar.gz
76
- ./dist/*.whl
77
- - name : Create GitHub Release
78
- env :
79
- GITHUB_TOKEN : ${{ github.token }}
80
- run : >-
81
- gh release create
82
- '${{ github.ref_name }}'
83
- --repo '${{ github.repository }}'
84
- --notes ""
85
- - name : Upload artifact signatures to GitHub Release
86
- env :
87
- GITHUB_TOKEN : ${{ github.token }}
88
- # Upload to GitHub Release using the `gh` CLI.
89
- # `dist/` contains the built packages, and the
90
- # sigstore-produced signatures and certificates.
91
- run : >-
92
- gh release upload
93
- '${{ github.ref_name }}' dist/**
94
- --repo '${{ github.repository }}'
70
+ - name : Download all the dists
71
+ uses : actions/download-artifact@v4
72
+ with :
73
+ name : python-package-distributions
74
+ path : dist/
75
+ - name : Sign the dists with Sigstore
76
+
77
+ with :
78
+ inputs : >-
79
+ ./dist/*.tar.gz
80
+ ./dist/*.whl
81
+
82
+ - name : Create GitHub Release
83
+ env :
84
+ GITHUB_TOKEN : ${{ github.token }}
85
+ run : >-
86
+ gh release create
87
+ '${{ github.ref_name }}'
88
+ --repo '${{ github.repository }}'
89
+ --generate-notes
90
+ - name : Upload artifact signatures to GitHub Release
91
+ env :
92
+ GITHUB_TOKEN : ${{ github.token }}
93
+ # Upload to GitHub Release using the `gh` CLI.
94
+ # `dist/` contains the built packages, and the
95
+ # sigstore-produced signatures and certificates.
96
+ run : >-
97
+ gh release upload
98
+ '${{ github.ref_name }}' dist/**
99
+ --repo '${{ github.repository }}'
95
100
96
101
publish-to-testpypi :
97
102
name : Publish Python 🐍 distribution 📦 to TestPyPI
103
+ if : github.repository == 'containers/podman-py'
98
104
needs :
99
- - build
105
+ - build
100
106
runs-on : ubuntu-latest
101
107
102
108
environment :
103
109
name : testpypi
104
110
url : https://test.pypi.org/p/podman
105
111
106
112
permissions :
107
- id-token : write # IMPORTANT: mandatory for trusted publishing
113
+ id-token : write # IMPORTANT: mandatory for trusted publishing
108
114
109
115
steps :
110
- - name : Download all the dists
111
- uses : actions/download-artifact@v4
112
- with :
113
- name : python-package-distributions
114
- path : dist/
115
- - name : Publish distribution 📦 to TestPyPI
116
- uses : pypa/gh-action-pypi-publish@release/v1
117
- with :
118
- repository-url : https://test.pypi.org/legacy/
116
+ - name : Download all the dists
117
+ uses : actions/download-artifact@v4
118
+ with :
119
+ name : python-package-distributions
120
+ path : dist/
121
+ - name : Publish distribution 📦 to TestPyPI
122
+ uses : pypa/gh-action-pypi-publish@release/v1
123
+ with :
124
+ repository-url : https://test.pypi.org/legacy/
0 commit comments