1
- # This workflow tests and releases a new version of the package, then publishes it to PyPi and the
2
- # octue/octue-sdk-python Docker Hub repository.
1
+ # This workflow tests and releases a new version of the package before publishing it to PyPi.
3
2
4
3
name : Release
5
4
10
9
branches :
11
10
- main
12
11
12
+ workflow_dispatch :
13
+ inputs :
14
+ ref :
15
+ description : " Branch or commit SHA to tag"
16
+ type : string
17
+ required : true
18
+ tag :
19
+ description : " Tag for release"
20
+ type : string
21
+ required : true
22
+
13
23
jobs :
14
24
run-tests :
15
- if : " github.event.pull_request.merged == true"
25
+ if : " ${{ github.event_name == 'workflow_dispatch' || && github. event.pull_request.merged == true }} "
16
26
runs-on : ${{ matrix.os }}
17
27
env :
18
28
USING_COVERAGE : " 3.10"
23
33
id-token : write
24
34
steps :
25
35
- name : Checkout Repository
26
- uses : actions/checkout@v3
36
+ uses : actions/checkout@v4
37
+ with :
38
+ ref : ${{ inputs.ref }}
27
39
28
40
- name : Setup Python
29
41
uses : actions/setup-python@v5
36
48
- name : Check pyproject.toml file
37
49
run : poetry check
38
50
39
- - name : Get package version
40
- id : get-package-version
41
- run : echo "PACKAGE_VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
42
-
43
51
- name : Install tox
44
52
run : pip install tox
45
53
@@ -65,19 +73,36 @@ jobs:
65
73
fail_ci_if_error : false
66
74
token : ${{ secrets.CODECOV_TOKEN }}
67
75
68
- outputs :
69
- package_version : ${{ steps.get-package-version.outputs.PACKAGE_VERSION }}
70
-
71
76
release :
72
77
runs-on : ubuntu-latest
73
78
needs : run-tests
74
79
steps :
80
+ - name : Checkout Repository
81
+ if : ${{ github.event_name != 'workflow_dispatch' }}
82
+ uses : actions/checkout@v4
83
+ with :
84
+ ref : ${{ inputs.ref }}
85
+
86
+ - name : Install Poetry
87
+ if : ${{ github.event_name != 'workflow_dispatch' }}
88
+
89
+
90
+ - name : Check pyproject.toml file
91
+ if : ${{ github.event_name != 'workflow_dispatch' }}
92
+ run : poetry check
93
+
94
+ - name : Get package version
95
+ id : get-package-version
96
+ if : ${{ github.event_name != 'workflow_dispatch' }}
97
+ run : echo "package_version=$(poetry version -s)" >> $GITHUB_OUTPUT
98
+
75
99
- name : Create Release
76
100
uses : actions/create-release@v1
77
101
env :
78
102
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, no need to create your own.
79
103
with :
80
- tag_name : ${{ needs.run-tests.outputs.package_version }}
104
+ commitish : ${{ inputs.ref }}
105
+ tag_name : ${{ inputs.tag || steps.get-package-version.outputs.package_version }}
81
106
release_name : ${{ github.event.pull_request.title }}
82
107
body : ${{ github.event.pull_request.body }}
83
108
draft : false
92
117
93
118
steps :
94
119
- name : Checkout Repository
95
- uses : actions/checkout@v3
120
+ uses : actions/checkout@v4
121
+ with :
122
+ ref : ${{ inputs.ref }}
96
123
97
124
- name : Install Poetry
98
125
0 commit comments