@@ -3,10 +3,6 @@ name: Reusable build workflow
33on :
44 workflow_call :
55 inputs :
6- ref :
7- description : ' The branch, tag or SHA to build'
8- required : true
9- type : string
106 release :
117 description : ' Release version tag for this build'
128 default : ' '
1511 docker :
1612 description : ' Build docker images'
1713 default : false
18- required : true
14+ required : false
1915 type : boolean
2016 docker_repository :
2117 description : ' Docker Hub Repository'
4036 description : ' Docker Hub Token'
4137 required : false
4238
39+ permissions :
40+ contents : read
41+
4342# shared build jobs
4443jobs :
4544 build_ui_package :
4645 name : Build UI package
4746 runs-on : ubuntu-latest
47+ outputs :
48+ artifact_id : ${{ steps.upload_ui.outputs.artifact-id }}
4849 steps :
4950 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
50- with :
51- ref : ${{ inputs.ref }}
5251
5352 # setup node & npm
5453 - name : Set up node
@@ -64,14 +63,15 @@ jobs:
6463 restore-keys : |
6564 uipackage-npm-${{ runner.os }}-
6665 uipackage-npm-
67-
66+
6867 # build UI package
6968 - name : Build UI package
7069 run : |
7170 make build-ui
7271
7372 # upload artifacts
7473 - name : " Upload artifact: ui-package"
74+ id : upload_ui
7575 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
7676 with :
7777 path : ./ui-package/dist/*
@@ -81,17 +81,17 @@ jobs:
8181 name : Build linux/amd64 binary
8282 needs : [build_ui_package]
8383 runs-on : ubuntu-latest
84+ outputs :
85+ artifact_id : ${{ steps.upload_binary.outputs.artifact-id }}
8486 steps :
8587 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
86- with :
87- ref : ${{ inputs.ref }}
8888
8989 # setup global dependencies
9090 - name : Set up go
9191 uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
9292 with :
9393 go-version : 1.25.x
94-
94+
9595 # setup project dependencies
9696 - name : Get dependencies
9797 run : |
@@ -101,7 +101,8 @@ jobs:
101101 - name : Download UI build artifacts
102102 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
103103 with :
104- name : ui-package
104+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
105+ merge-multiple : true
105106 path : ./ui-package/dist
106107
107108 # build binaries
@@ -113,19 +114,20 @@ jobs:
113114
114115 # upload artifacts
115116 - name : " Upload artifact: explorer_linux_amd64"
117+ id : upload_binary
116118 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
117119 with :
118120 path : ./bin/*
119121 name : explorer_linux_amd64
120-
122+
121123 build_linux_arm64_binary :
122124 name : Build linux/arm64 binary
123125 needs : [build_ui_package]
124126 runs-on : ubuntu-24.04-arm
127+ outputs :
128+ artifact_id : ${{ steps.upload_binary.outputs.artifact-id }}
125129 steps :
126130 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
127- with :
128- ref : ${{ inputs.ref }}
129131
130132 # setup global dependencies
131133 - name : Set up go
@@ -142,7 +144,8 @@ jobs:
142144 - name : Download UI build artifacts
143145 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
144146 with :
145- name : ui-package
147+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
148+ merge-multiple : true
146149 path : ./ui-package/dist
147150
148151 # build binaries
@@ -154,6 +157,7 @@ jobs:
154157
155158 # upload artifacts
156159 - name : " Upload artifact: explorer_linux_arm64"
160+ id : upload_binary
157161 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
158162 with :
159163 path : ./bin/*
@@ -165,8 +169,6 @@ jobs:
165169 runs-on : windows-latest
166170 steps :
167171 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
168- with :
169- ref : ${{ inputs.ref }}
170172
171173 # setup global dependencies
172174 - name : Set up go
@@ -183,7 +185,8 @@ jobs:
183185 - name : Download UI build artifacts
184186 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
185187 with :
186- name : ui-package
188+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
189+ merge-multiple : true
187190 path : ./ui-package/dist
188191
189192 # build binaries
@@ -200,55 +203,12 @@ jobs:
200203 path : ./bin/*
201204 name : explorer_windows_amd64
202205
203- build_darwin_amd64_binary :
204- name : Build macos/amd64 binary
205- needs : [build_ui_package]
206- runs-on : macos-15-intel
207- steps :
208- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
209- with :
210- ref : ${{ inputs.ref }}
211-
212- # setup global dependencies
213- - name : Set up go
214- uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
215- with :
216- go-version : 1.25.x
217-
218- # setup project dependencies
219- - name : Get dependencies
220- run : |
221- go get -v -t -d ./...
222-
223- # download UI build artifacts
224- - name : Download UI build artifacts
225- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
226- with :
227- name : ui-package
228- path : ./ui-package/dist
229-
230- # build binaries
231- - name : Build macos amd64 binary
232- run : |
233- make build
234- env :
235- RELEASE : ${{ inputs.release }}
236-
237- # upload artifacts
238- - name : " Upload artifact: explorer_darwin_amd64"
239- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
240- with :
241- path : ./bin/*
242- name : explorer_darwin_amd64
243-
244206 build_darwin_arm64_binary :
245207 name : Build macos/arm64 binary
246208 needs : [build_ui_package]
247209 runs-on : macos-26
248210 steps :
249211 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
250- with :
251- ref : ${{ inputs.ref }}
252212
253213 # setup global dependencies
254214 - name : Set up go
@@ -265,7 +225,8 @@ jobs:
265225 - name : Download UI build artifacts
266226 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
267227 with :
268- name : ui-package
228+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
229+ merge-multiple : true
269230 path : ./ui-package/dist
270231
271232 # build binaries
@@ -284,13 +245,11 @@ jobs:
284245
285246 build_amd64_docker_image :
286247 name : Build amd64 docker image
287- needs : [build_linux_amd64_binary]
248+ needs : [build_ui_package, build_linux_amd64_binary]
288249 if : ${{ inputs.docker }}
289250 runs-on : ubuntu-latest
290251 steps :
291252 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
292- with :
293- ref : ${{ inputs.ref }}
294253
295254 - name : Get build version
296255 id : vars
@@ -309,20 +268,22 @@ jobs:
309268 - name : Download UI build artifacts
310269 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
311270 with :
312- name : ui-package
271+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
272+ merge-multiple : true
313273 path : ./ui-package/dist
314274 - name : Download build artifacts
315275 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
316276 with :
317- name : explorer_linux_amd64
277+ artifact-ids : ${{ needs.build_linux_amd64_binary.outputs.artifact_id }}
278+ merge-multiple : true
318279 path : ./bin
319280
320281 # prepare environment
321282 - name : Prepare build environment
322283 run : |
323284 chmod +x ./bin/*
324285 ls -lach ./bin
325-
286+
326287 # build amd64 image
327288 - name : Build amd64 docker image
328289 run : |
@@ -334,16 +295,14 @@ jobs:
334295 run : |
335296 docker push ${{ inputs.docker_repository }}:${{ inputs.docker_tag_prefix }}-amd64
336297 docker push ${{ inputs.docker_repository }}:${{ inputs.docker_tag_prefix }}-${{ steps.vars.outputs.sha_short }}-amd64
337-
298+
338299 build_arm64_docker_image :
339300 name : Build arm64 docker image
340- needs : [build_linux_arm64_binary]
301+ needs : [build_ui_package, build_linux_arm64_binary]
341302 if : ${{ inputs.docker }}
342303 runs-on : ubuntu-24.04-arm
343304 steps :
344305 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
345- with :
346- ref : ${{ inputs.ref }}
347306 - name : Get build version
348307 id : vars
349308 run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
@@ -361,20 +320,22 @@ jobs:
361320 - name : Download UI build artifacts
362321 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
363322 with :
364- name : ui-package
323+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
324+ merge-multiple : true
365325 path : ./ui-package/dist
366326 - name : Download build artifacts
367327 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
368328 with :
369- name : explorer_linux_arm64
329+ artifact-ids : ${{ needs.build_linux_arm64_binary.outputs.artifact_id }}
330+ merge-multiple : true
370331 path : ./bin
371332
372333 # prepare environment
373334 - name : Prepare build environment
374335 run : |
375336 chmod +x ./bin/*
376337 ls -lach ./bin
377-
338+
378339 # build arm64 image
379340 - name : Build arm64 docker image
380341 run : |
@@ -394,8 +355,6 @@ jobs:
394355 runs-on : ubuntu-latest
395356 steps :
396357 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
397- with :
398- ref : ${{ inputs.ref }}
399358 - name : Get build version
400359 id : vars
401360 run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
@@ -408,7 +367,7 @@ jobs:
408367 with :
409368 username : ${{ secrets.DOCKERHUB_USERNAME }}
410369 password : ${{ secrets.DOCKERHUB_TOKEN }}
411-
370+
412371 # build multiarch image
413372 - name : Build multiarch docker manifest
414373 run : |
@@ -426,8 +385,6 @@ jobs:
426385 tag : ${{ fromJSON(inputs.additional_tags) }}
427386 steps :
428387 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
429- with :
430- ref : ${{ inputs.ref }}
431388 - name : Get build version
432389 id : vars
433390 run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
@@ -440,7 +397,7 @@ jobs:
440397 with :
441398 username : ${{ secrets.DOCKERHUB_USERNAME }}
442399 password : ${{ secrets.DOCKERHUB_TOKEN }}
443-
400+
444401 # build multiarch image
445402 - name : " Build additional docker manifest: ${{ matrix.tag }}"
446403 run : |
@@ -452,4 +409,4 @@ jobs:
452409
453410 docker buildx imagetools create -t ${{ inputs.docker_repository }}:${{ matrix.tag }} \
454411 ${{ inputs.docker_repository }}:${{ inputs.docker_tag_prefix }}-${{ steps.vars.outputs.sha_short }}-amd64 \
455- ${{ inputs.docker_repository }}:${{ inputs.docker_tag_prefix }}-${{ steps.vars.outputs.sha_short }}-arm64
412+ ${{ inputs.docker_repository }}:${{ inputs.docker_tag_prefix }}-${{ steps.vars.outputs.sha_short }}-arm64
0 commit comments