1
1
name : Build & Release
2
2
3
3
on :
4
+ workflow_call :
5
+ inputs :
6
+ tag :
7
+ required : true
8
+ type : string
9
+ description : Tag to release
10
+ # TODO(CG-10758): create if it does not exist
11
+ # workflow_dispatch:
12
+ # inputs:
13
+ # tag:
14
+ # required: true
15
+ # type: string
16
+ # description: Tag to release # TODO: create if it does not exist
4
17
push :
5
18
tags :
6
19
- v*
7
- branches :
8
- - develop
9
20
pull_request :
10
21
branches :
11
22
- develop
12
- workflow_dispatch :
13
23
14
24
permissions :
15
25
contents : read
41
51
- uses : actions/checkout@v4
42
52
with :
43
53
fetch-depth : 0
44
- ref : ${{ github.event.pull_request.head.ref || github.ref }}
54
+ ref : ${{ inputs.tag || github.event.pull_request.head.ref || github.ref }}
45
55
46
56
- name : Install UV
47
57
@@ -69,71 +79,17 @@ jobs:
69
79
name : wheels-${{ matrix.os }}-3.${{ matrix.python }}
70
80
path : ./wheelhouse/*.whl
71
81
72
- auto-release :
73
- if : github.ref_name == 'develop'
74
- environment : release
82
+ release :
83
+ if : ${{ inputs.tag || startsWith(github.ref, 'refs/tags/') }}
75
84
needs : build
76
85
runs-on : ubuntu-latest
77
- permissions :
78
- checks : read # to wait for required checks
79
- contents : write # to be able to publish a GitHub release
80
- issues : write # to be able to comment on released issues
81
- pull-requests : write # to be able to comment on released pull requests
82
- steps :
83
- - uses : actions/checkout@v4
84
- with :
85
- fetch-depth : 0
86
-
87
- # TODO(CG-10743): clean-up once we remove LFS
88
- - name : Remove pre-push hook
89
- run : rm -f .git/hooks/pre-push
90
-
91
- - name : Setup environment
92
- uses : ./.github/actions/setup-environment
93
-
94
- - name : Wait for required checks
95
-
96
- with :
97
- token : ${{ secrets.GITHUB_TOKEN }}
98
- match_pattern : " (unit-tests|integration-tests)"
99
-
100
- - name : Download All Artifacts
101
- uses : actions/download-artifact@v4
102
- with :
103
- path : dist
104
- merge-multiple : true
105
- pattern : wheels-*
106
-
107
- - name : Github semantic release
108
- uses : codfish/semantic-release-action@v3
109
- id : semantic
110
- env :
111
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
112
-
113
- - name : Release PyPI
114
- if : ${{ steps.semantic.outputs.new-release-published == 'true' }}
115
- uses : ./.github/actions/release-pypi
116
- with :
117
- pypi-token : ${{ secrets.PYPI_TOKEN }}
118
-
119
- - name : Slack notification
120
- if : ${{ steps.semantic.outputs.new-release-published == 'true' }}
121
- uses : ./.github/actions/release-slack-bot
122
- with :
123
- release-tag : ${{ steps.semantic.outputs.release-version }}
124
- slack-token : ${{ secrets.SLACK_BOT_TOKEN }}
125
-
126
- manual-release :
127
- if : startsWith(github.ref, 'refs/tags/')
128
86
environment : release
129
- needs : build
130
- runs-on : ubuntu-latest
131
87
permissions :
132
88
contents : write # grants permission to create a release on github
133
89
steps :
134
90
- uses : actions/checkout@v4
135
91
136
- - name : Setup environment
92
+ - name : Setup backend
137
93
uses : ./.github/actions/setup-environment
138
94
139
95
- name : Download All Artifacts
@@ -152,9 +108,10 @@ jobs:
152
108
id : github-release
153
109
uses : softprops/action-gh-release@v2
154
110
with :
111
+ tag_name : ${{ inputs.tag || github.ref_name }}
155
112
files : dist/*
156
113
fail_on_unmatched_files : true
157
- generate_release_notes : true
114
+ generate_release_notes : ${{ startsWith(github.ref, 'refs/tags/') }}
158
115
159
116
- name : Slack notification
160
117
if : always()
0 commit comments