@@ -5,19 +5,28 @@ name: Publish releases
5
5
on :
6
6
release :
7
7
types : [published]
8
+ workflow_dispatch :
9
+ inputs :
10
+ version :
11
+ description : " Version for release on TestPyPI"
12
+ required : true
8
13
env :
9
14
PYTHON_VERSION : " 3.12"
10
15
11
16
jobs :
12
- build-and-publish-pypi :
17
+ build :
13
18
name : Builds and publishes releases to PyPI
14
19
runs-on : ubuntu-latest
15
20
steps :
16
21
17
- - name : Get tag
18
- id : vars
22
+ - name : Store version from inputs
23
+ if : github.event_name == 'workflow_dispatch'
24
+ run : echo "tag=${{ inputs.version }}"
25
+ - name : Get version from tag
26
+ if : github.event_name == 'release'
19
27
run : echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
20
28
- name : Validate version number
29
+ if : github.event_name == 'release'
21
30
run : >-
22
31
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
23
32
if ! [[ "${tag}" =~ "b" ]]; then
@@ -53,10 +62,50 @@ jobs:
53
62
- name : Build python package
54
63
run : >-
55
64
python3 -m build
56
- - name : Publish release to PyPI
57
-
65
+ - name : Store the distribution packages
66
+ uses : actions/upload-artifact@v4
58
67
with :
59
- user : __token__
60
- password : ${{ secrets.PYPI_TOKEN }}
61
- - name : Wait for PyPI
62
- run : sleep 300
68
+ name : python-package-distributions
69
+ path : dist/
70
+
71
+ publish-pypi :
72
+ name : Publishes releases to PyPI
73
+ runs-on : ubuntu-latest
74
+ if : github.event_name == 'release'
75
+ needs :
76
+ - build
77
+ environment :
78
+ name : pypi
79
+ url : https://pypi.org/p/aiohasupervisor
80
+ permissions :
81
+ id-token : write
82
+ steps :
83
+ - name : Download all the dists
84
+ uses : actions/download-artifact@v4
85
+ with :
86
+ name : python-package-distributions
87
+ path : dist/
88
+ - name : Publish distribution 📦 to PyPI
89
+ uses : pypa/gh-action-pypi-publish@release/v1
90
+
91
+ publish-test-pypi :
92
+ name : Publishes releases to Test-PyPI
93
+ runs-on : ubuntu-latest
94
+ if : github.event_name == 'workflow_dispatch'
95
+ needs :
96
+ - build
97
+ environment :
98
+ name : testpypi
99
+ url : https://test.pypi.org/p/aiohasupervisor
100
+ permissions :
101
+ id-token : write
102
+ steps :
103
+ - name : Download all the dists
104
+ uses : actions/download-artifact@v4
105
+ with :
106
+ name : python-package-distributions
107
+ path : dist/
108
+ - name : Publish distribution 📦 to TestPyPI
109
+ uses : pypa/gh-action-pypi-publish@release/v1
110
+ with :
111
+ repository-url : https://test.pypi.org/legacy/
0 commit comments