21
21
- ' manual/**'
22
22
- ' cmake/GetGALERA.cmake'
23
23
- ' galera_packaging/**'
24
+ tags :
25
+ - ' release*'
24
26
25
27
# cancels the previous workflow run when a new one appears in the same branch (e.g. master or a PR's branch)
26
28
concurrency :
64
66
pack :
65
67
name : OK to pack?
66
68
runs-on : ubuntu-22.04
69
+ permissions :
70
+ contents : write
71
+ pull-requests : read
72
+ outputs :
73
+ version : ${{ steps.semver-tagger.outputs.version }}
74
+ version_full : ${{ steps.semver-tagger.outputs.version_full }}
75
+ version_rpm : ${{ steps.semver-tagger.outputs.version_rpm }}
76
+ version_deb : ${{ steps.semver-tagger.outputs.version_deb }}
77
+ target : ${{ steps.semver-tagger.outputs.target }}
78
+ should_continue : ${{ steps.check-should-continue.outputs.should_continue }}
67
79
if : |
68
80
(
69
81
github.event_name == 'pull_request'
@@ -95,18 +107,45 @@ jobs:
95
107
)
96
108
)
97
109
steps :
98
- - run : echo "All set to build packages"
110
+ - name : Checkout repository
111
+ uses : actions/checkout@v3
112
+ with :
113
+ fetch-depth : 0
114
+ - name : Update version
115
+ id : semver-tagger
116
+ uses : manticoresoftware/semver-tagger-action@main
117
+ with :
118
+ github_token : ${{ secrets.GITHUB_TOKEN }}
119
+ ignore_patterns : ' \.md$|^test/|^manual/|\.clt|\.github|\.patterns|\.yml|\.gitignore'
120
+ - name : Check if we should continue packing
121
+ id : check-should-continue
122
+ run : |
123
+ # Continue if version was updated or if we have the "pack" label on PR
124
+ if [[ "${{ steps.semver-tagger.outputs.version_updated }}" == "true" ]]; then
125
+ echo "Continuing because version was updated"
126
+ echo "should_continue=true" >> $GITHUB_OUTPUT
127
+ elif [[ "${{ github.event_name }}" == "pull_request" && "${{ contains(github.event.pull_request.labels.*.name, 'pack') }}" == "true" ]]; then
128
+ echo "Continuing because PR has 'pack' label"
129
+ echo "should_continue=true" >> $GITHUB_OUTPUT
130
+ else
131
+ echo "Skipping packing because version wasn't updated and there's no 'pack' label"
132
+ echo "should_continue=false" >> $GITHUB_OUTPUT
133
+ fi
99
134
- run : |
100
- echo '# Packing and publishing all for commit ${{ github.sha }}' >> $GITHUB_STEP_SUMMARY
101
- echo '* Commit URL: [${{ github.sha }}](/${{ github.repository }}/commit/${{ github.sha }})' >> $GITHUB_STEP_SUMMARY
102
- echo '* Initiated by: [@${{ github.actor }}](https://github.com/${{ github.actor }})' >> $GITHUB_STEP_SUMMARY
103
- echo '* Ref: ${{ github.ref_type }} "${{ github.ref_name }}"' >> $GITHUB_STEP_SUMMARY
104
- echo '* Attempt: ${{ github.run_attempt }}' >> $GITHUB_STEP_SUMMARY
135
+ echo "# Packing and publishing all for commit ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
136
+ echo "* Commit URL: [${{ github.sha }}](/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_STEP_SUMMARY
137
+ echo "* Initiated by: [@${{ github.actor }}](https://github.com/${{ github.actor }})" >> $GITHUB_STEP_SUMMARY
138
+ echo "* Ref: ${{ github.ref_type }} \"${{ github.ref_name }}\"" >> $GITHUB_STEP_SUMMARY
139
+ echo "* Attempt: ${{ github.run_attempt }}" >> $GITHUB_STEP_SUMMARY
140
+ echo "* Version updated: ${{ steps.semver-tagger.outputs.version_updated }}" >> $GITHUB_STEP_SUMMARY
141
+ echo "* Should continue packing: ${{ steps.check-should-continue.outputs.should_continue }}" >> $GITHUB_STEP_SUMMARY
142
+
105
143
106
144
pack_debian_ubuntu :
107
145
name : Debian/Ubuntu packages
108
146
uses : ./.github/workflows/build_template.yml
109
147
needs : [pack, check_branch]
148
+ if : needs.pack.outputs.should_continue == 'true'
110
149
strategy :
111
150
fail-fast : false
112
151
matrix :
@@ -124,11 +163,14 @@ jobs:
124
163
cmake --build . --target package
125
164
cache_key : pack_${{ matrix.DISTR }}_${{ matrix.arch }}
126
165
artifact_list : " build/manticore*deb"
166
+ version : ${{ needs.pack.outputs.version }}
167
+ build_tag : ${{ needs.pack.outputs.target == 'dev' && 'dev' || '' }}
127
168
128
169
pack_rhel :
129
170
name : RHEL packages
130
171
uses : ./.github/workflows/build_template.yml
131
172
needs : [pack, check_branch]
173
+ if : needs.pack.outputs.should_continue == 'true'
132
174
strategy :
133
175
fail-fast : false
134
176
matrix :
@@ -149,11 +191,14 @@ jobs:
149
191
cmake --build . --target package
150
192
cache_key : pack_${{ matrix.DISTR }}_${{ matrix.arch }}
151
193
artifact_list : " build/manticore*rpm"
194
+ version : ${{ needs.pack.outputs.version }}
195
+ build_tag : ${{ needs.pack.outputs.target == 'dev' && 'dev' || '' }}
152
196
153
197
pack_macos :
154
198
name : MacOS packages
155
199
uses : ./.github/workflows/build_template.yml
156
200
needs : [pack, check_branch]
201
+ if : needs.pack.outputs.should_continue == 'true'
157
202
strategy :
158
203
fail-fast : false
159
204
matrix :
@@ -172,11 +217,14 @@ jobs:
172
217
cmake --build . --target package
173
218
cache_key : pack_${{ matrix.DISTR }}_${{ matrix.arch }}
174
219
artifact_list : " build/manticore*tar.gz"
220
+ version : ${{ needs.pack.outputs.version }}
221
+ build_tag : ${{ needs.pack.outputs.target == 'dev' && 'dev' || '' }}
175
222
176
223
pack_windows :
177
224
name : Windows x64 package
178
225
uses : ./.github/workflows/build_template.yml
179
226
needs : [pack, check_branch]
227
+ if : needs.pack.outputs.should_continue == 'true'
180
228
with :
181
229
COLUMNAR_LOCATOR : ${{ needs.check_branch.outputs.columnar_locator }}
182
230
DISTR : windows
@@ -191,10 +239,13 @@ jobs:
191
239
cmake --build . --target package
192
240
cache_key : pack_windows_x64
193
241
artifact_list : " build/manticore*exe build/manticore*zip"
194
-
242
+ version : ${{ needs.pack.outputs.version }}
243
+ build_tag : ${{ needs.pack.outputs.target == 'dev' && 'dev' || '' }}
244
+
195
245
build_nsis :
196
246
name : Making Windows NSIS installer
197
- needs : pack_windows
247
+ needs : [pack_windows, pack]
248
+ if : needs.pack.outputs.should_continue == 'true'
198
249
runs-on : ubuntu-22.04
199
250
container :
200
251
image : manticoresearch/build_nsis:1.0.0
@@ -203,14 +254,17 @@ jobs:
203
254
steps :
204
255
- name : Checkout repository # We have to checkout to access .github/workflows/ in further steps
205
256
uses : actions/checkout@v3
257
+ - name : Patch version
258
+ run : |
259
+ sed -i "s/0\.0\.0/${{ needs.pack.outputs.version }}/g" src/sphinxversion.h.in
206
260
- name : Initialization
207
261
# without adding the safe.directory the script fails to do git show ...
208
262
run : git config --global --add safe.directory /__w/manticoresearch/manticoresearch
209
263
- name : Make installer
210
264
# TODO: remove the hardcoded paths /builds/ below
211
265
run : |
212
266
mkdir -p /builds/manticoresearch/dev/build/
213
- /bin/bash dist/build_dockers/nsis/nsis_src_parser.sh
267
+ /bin/bash dist/build_dockers/nsis/nsis_src_parser.sh ${{ needs.pack.outputs.target }}
214
268
shell : bash
215
269
- run : mv /builds/manticoresearch/dev/build build
216
270
- name : Upload artifact
@@ -236,7 +290,7 @@ jobs:
236
290
- run : echo "Ready to publish"
237
291
238
292
publish_debian_ubuntu :
239
- needs : publish
293
+ needs : [ publish, pack]
240
294
strategy :
241
295
fail-fast : true
242
296
matrix :
@@ -253,9 +307,10 @@ jobs:
253
307
artifact : build_${{ matrix.DISTR }}_RelWithDebInfo_${{ matrix.arch }}
254
308
type : deb
255
309
delimiter : " -"
310
+ target : ${{ needs.pack.outputs.target }}
256
311
257
312
publish_rhel :
258
- needs : publish
313
+ needs : [ publish, pack]
259
314
strategy :
260
315
fail-fast : true
261
316
matrix :
@@ -272,10 +327,11 @@ jobs:
272
327
artifact : build_rhel${{ matrix.DISTR }}_RelWithDebInfo_${{ matrix.arch }}
273
328
type : rpm
274
329
delimiter : " _"
330
+ target : ${{ needs.pack.outputs.target }}
275
331
276
332
publish_macos :
277
333
name : Publishing MacOS
278
- needs : publish
334
+ needs : [ publish, pack]
279
335
strategy :
280
336
fail-fast : true
281
337
matrix :
@@ -290,10 +346,11 @@ jobs:
290
346
artifact : build_macos_RelWithDebInfo_${{ matrix.arch }}
291
347
type : arc
292
348
delimiter : " -"
349
+ target : ${{ needs.pack.outputs.target }}
293
350
294
351
publish_windows :
295
352
name : Publishing Windows packages to repo.manticoresearch.com
296
- needs : publish
353
+ needs : [ publish, pack]
297
354
runs-on : ubuntu-22.04
298
355
steps :
299
356
- uses : manticoresoftware/publish_to_repo@main
@@ -304,10 +361,11 @@ jobs:
304
361
artifact : build_windows_RelWithDebInfo_x64
305
362
type : arc
306
363
delimiter : " -"
364
+ target : ${{ needs.pack.outputs.target }}
307
365
308
366
publish_nsis :
309
367
name : Publishing Windows NSIS installer
310
- needs : publish_windows
368
+ needs : [ publish_windows, publish, pack]
311
369
runs-on : ubuntu-22.04
312
370
steps :
313
371
- uses : manticoresoftware/publish_to_repo@main
@@ -318,10 +376,11 @@ jobs:
318
376
artifact : win_installer
319
377
type : arc
320
378
delimiter : " -"
379
+ target : ${{ needs.pack.outputs.target }}
321
380
322
381
build_docker :
323
382
name : Building and pushing docker
324
- needs : publish_debian_ubuntu
383
+ needs : [ publish_debian_ubuntu, pack]
325
384
runs-on : ubuntu-22.04
326
385
env :
327
386
DOCKER_USER : ${{ secrets.DOCKER_USER }}
@@ -331,6 +390,9 @@ jobs:
331
390
steps :
332
391
- name : Checkout repository # We have to checkout to access .github/workflows/ in further steps
333
392
uses : actions/checkout@v3
393
+ - name : Patch version
394
+ run : |
395
+ sed -i "s/0\.0\.0/${{ needs.pack.outputs.version }}/g" src/sphinxversion.h.in
334
396
- name : Calculate short commit hash
335
397
id : sha
336
398
run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
@@ -350,7 +412,7 @@ jobs:
350
412
image : [ "centos:7", "almalinux:8", "almalinux:9", "oraclelinux:9", "amazonlinux:latest" ]
351
413
runs-on : ubuntu-22.04
352
414
steps :
353
- -
uses :
manticoresoftware/[email protected] .3
415
+ -
uses :
manticoresoftware/[email protected] .5
354
416
with :
355
417
image : ${{ matrix.image }}
356
418
test_prefix : test/clt-tests/installation/rhel-dev-
@@ -365,7 +427,7 @@ jobs:
365
427
image : [ "ubuntu:bionic", "ubuntu:focal", "ubuntu:jammy", "debian:buster", "debian:bullseye", "debian:bookworm" ]
366
428
runs-on : ubuntu-22.04
367
429
steps :
368
- -
uses :
manticoresoftware/[email protected] .3
430
+ -
uses :
manticoresoftware/[email protected] .5
369
431
with :
370
432
image : ${{ matrix.image }}
371
433
test_prefix : test/clt-tests/installation/deb-dev-
0 commit comments