1
1
name : Kazoo Awesome Release
2
2
3
3
on :
4
+ workflow_call :
5
+ inputs :
6
+ TAG_BUILD :
7
+ description : ' The egg info tag build (will be appended to `kazoo.version` value)'
8
+ default : " "
9
+ required : false
10
+ type : string
11
+ USE_TEST_PYPI :
12
+ description : ' Whether to the use the TestPyPI repository or not'
13
+ default : false
14
+ required : false
15
+ type : boolean
16
+ PYTHON_VERSION :
17
+ description : ' The Python version to use to perform the steps'
18
+ default : " "
19
+ required : true
20
+ type : string
4
21
push :
5
22
tags :
6
23
- ' *'
7
24
25
+ env :
26
+ DEFAULT_TOOLING_PYTHON_VERSION : " 3.10"
27
+
8
28
jobs :
9
29
build-and-release :
10
- name : Build and release Kazoo to Pypi
30
+ name : Build and release Kazoo to PyPI
11
31
runs-on : ubuntu-latest
12
32
steps :
33
+
34
+ # this is to handle the on:push:tags case, to which it is not possible to set
35
+ # default values
36
+ - name : Maybe set default vars
37
+ id : thevars
38
+ run : |
39
+ DEFINED_PYTHON_VERSION=${{ github.event.inputs.PYTHON_VERSION }}
40
+ echo "::set-output name=PYTHON_VERSION::${DEFINED_PYTHON_VERSION:-"${{ env.DEFAULT_TOOLING_PYTHON_VERSION }}"}"
41
+
13
42
- name : Handle the code
14
43
uses : actions/checkout@v3
15
44
16
- - name : Set up Python 3.10
45
+ - name : Set up Python
17
46
uses : actions/setup-python@v4
18
47
with :
19
- python-version : " 3.10 "
48
+ python-version : ${{ steps.thevars.outputs.PYTHON_VERSION }}
20
49
21
50
- name : Install pypa/build
22
51
run : >-
@@ -30,14 +59,21 @@ jobs:
30
59
python -m
31
60
build
32
61
-C--global-option=egg_info
33
- -C--global-option=--tag-build=""
62
+ -C--global-option=--tag-build="${{ inputs.TAG_BUILD }} "
34
63
--sdist
35
64
--wheel
36
65
--outdir dist/
37
66
.
38
67
68
+ - name : Publish Kazoo to TestPyPI
69
+ if : inputs.USE_TEST_PYPI == 'true'
70
+ uses : pypa/gh-action-pypi-publish@master
71
+ with :
72
+ password : ${{ secrets.TEST_PYPI_API_TOKEN }}
73
+ repository_url : https://test.pypi.org/legacy/
74
+
39
75
- name : Publish Kazoo to PyPI
40
- if : startsWith(github.ref, 'refs/tags')
76
+ if : inputs.USE_TEST_PYPI == 'false'
41
77
uses : pypa/gh-action-pypi-publish@master
42
78
with :
43
79
password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments