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
21
+ secrets :
22
+ TEST_PYPI_API_TOKEN :
23
+ required : false
24
+ PYPI_API_TOKEN :
25
+ required : false
4
26
push :
5
27
tags :
6
28
- ' *'
7
29
30
+ env :
31
+ DEFAULT_TOOLING_PYTHON_VERSION : " 3.10"
32
+
8
33
jobs :
9
34
build-and-release :
10
- name : Build and release Kazoo to Pypi
35
+ name : Build and release Kazoo to PyPI
11
36
runs-on : ubuntu-latest
12
37
steps :
38
+
39
+ # this is to handle the on:push:tags case, to which it is not possible to set
40
+ # default values
41
+ - name : Maybe set default vars
42
+ id : thevars
43
+ run : |
44
+ DEFINED_PYTHON_VERSION=${{ inputs.PYTHON_VERSION }}
45
+ echo "PYTHON_VERSION=${DEFINED_PYTHON_VERSION:-"${{ env.DEFAULT_TOOLING_PYTHON_VERSION }}"}" >> $GITHUB_OUTPUT
46
+
13
47
- name : Handle the code
14
48
uses : actions/checkout@v3
15
49
16
- - name : Set up Python 3.10
50
+ - name : Set up Python
17
51
uses : actions/setup-python@v4
18
52
with :
19
- python-version : " 3.10 "
53
+ python-version : ${{ steps.thevars.outputs.PYTHON_VERSION }}
20
54
21
55
- name : Install pypa/build
22
56
run : >-
@@ -29,15 +63,22 @@ jobs:
29
63
run : >-
30
64
python -m
31
65
build
32
- -C--global -option=egg_info
33
- -C--global -option=--tag-build=""
66
+ -C--build -option=egg_info
67
+ -C--build -option=--tag-build="${{ inputs.TAG_BUILD }} "
34
68
--sdist
35
69
--wheel
36
70
--outdir dist/
37
71
.
38
72
73
+ - name : Publish Kazoo to TestPyPI
74
+ if : ${{ inputs.USE_TEST_PYPI }}
75
+ uses : pypa/gh-action-pypi-publish@release/v1
76
+ with :
77
+ password : ${{ secrets.TEST_PYPI_API_TOKEN }}
78
+ repository_url : https://test.pypi.org/legacy/
79
+
39
80
- name : Publish Kazoo to PyPI
40
- if : startsWith( github.ref, 'refs/tags')
41
- uses : pypa/gh-action-pypi-publish@master
81
+ if : ${{ github.event_name == 'push' || !inputs.USE_TEST_PYPI }}
82
+ uses : pypa/gh-action-pypi-publish@release/v1
42
83
with :
43
84
password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments