@@ -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
@@ -206,8 +209,6 @@ jobs:
206209 runs-on : macos-26
207210 steps :
208211 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
209- with :
210- ref : ${{ inputs.ref }}
211212
212213 # setup global dependencies
213214 - name : Set up go
@@ -224,7 +225,8 @@ jobs:
224225 - name : Download UI build artifacts
225226 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
226227 with :
227- name : ui-package
228+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
229+ merge-multiple : true
228230 path : ./ui-package/dist
229231
230232 # build binaries
@@ -243,13 +245,11 @@ jobs:
243245
244246 build_amd64_docker_image :
245247 name : Build amd64 docker image
246- needs : [build_linux_amd64_binary]
248+ needs : [build_ui_package, build_linux_amd64_binary]
247249 if : ${{ inputs.docker }}
248250 runs-on : ubuntu-latest
249251 steps :
250252 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
251- with :
252- ref : ${{ inputs.ref }}
253253
254254 - name : Get build version
255255 id : vars
@@ -268,20 +268,22 @@ jobs:
268268 - name : Download UI build artifacts
269269 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
270270 with :
271- name : ui-package
271+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
272+ merge-multiple : true
272273 path : ./ui-package/dist
273274 - name : Download build artifacts
274275 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
275276 with :
276- name : explorer_linux_amd64
277+ artifact-ids : ${{ needs.build_linux_amd64_binary.outputs.artifact_id }}
278+ merge-multiple : true
277279 path : ./bin
278280
279281 # prepare environment
280282 - name : Prepare build environment
281283 run : |
282284 chmod +x ./bin/*
283285 ls -lach ./bin
284-
286+
285287 # build amd64 image
286288 - name : Build amd64 docker image
287289 run : |
@@ -293,16 +295,14 @@ jobs:
293295 run : |
294296 docker push ${{ inputs.docker_repository }}:${{ inputs.docker_tag_prefix }}-amd64
295297 docker push ${{ inputs.docker_repository }}:${{ inputs.docker_tag_prefix }}-${{ steps.vars.outputs.sha_short }}-amd64
296-
298+
297299 build_arm64_docker_image :
298300 name : Build arm64 docker image
299- needs : [build_linux_arm64_binary]
301+ needs : [build_ui_package, build_linux_arm64_binary]
300302 if : ${{ inputs.docker }}
301303 runs-on : ubuntu-24.04-arm
302304 steps :
303305 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
304- with :
305- ref : ${{ inputs.ref }}
306306 - name : Get build version
307307 id : vars
308308 run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
@@ -320,20 +320,22 @@ jobs:
320320 - name : Download UI build artifacts
321321 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
322322 with :
323- name : ui-package
323+ artifact-ids : ${{ needs.build_ui_package.outputs.artifact_id }}
324+ merge-multiple : true
324325 path : ./ui-package/dist
325326 - name : Download build artifacts
326327 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
327328 with :
328- name : explorer_linux_arm64
329+ artifact-ids : ${{ needs.build_linux_arm64_binary.outputs.artifact_id }}
330+ merge-multiple : true
329331 path : ./bin
330332
331333 # prepare environment
332334 - name : Prepare build environment
333335 run : |
334336 chmod +x ./bin/*
335337 ls -lach ./bin
336-
338+
337339 # build arm64 image
338340 - name : Build arm64 docker image
339341 run : |
@@ -353,8 +355,6 @@ jobs:
353355 runs-on : ubuntu-latest
354356 steps :
355357 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
356- with :
357- ref : ${{ inputs.ref }}
358358 - name : Get build version
359359 id : vars
360360 run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
@@ -367,7 +367,7 @@ jobs:
367367 with :
368368 username : ${{ secrets.DOCKERHUB_USERNAME }}
369369 password : ${{ secrets.DOCKERHUB_TOKEN }}
370-
370+
371371 # build multiarch image
372372 - name : Build multiarch docker manifest
373373 run : |
@@ -385,8 +385,6 @@ jobs:
385385 tag : ${{ fromJSON(inputs.additional_tags) }}
386386 steps :
387387 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
388- with :
389- ref : ${{ inputs.ref }}
390388 - name : Get build version
391389 id : vars
392390 run : echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
@@ -399,7 +397,7 @@ jobs:
399397 with :
400398 username : ${{ secrets.DOCKERHUB_USERNAME }}
401399 password : ${{ secrets.DOCKERHUB_TOKEN }}
402-
400+
403401 # build multiarch image
404402 - name : " Build additional docker manifest: ${{ matrix.tag }}"
405403 run : |
@@ -411,4 +409,4 @@ jobs:
411409
412410 docker buildx imagetools create -t ${{ inputs.docker_repository }}:${{ matrix.tag }} \
413411 ${{ inputs.docker_repository }}:${{ inputs.docker_tag_prefix }}-${{ steps.vars.outputs.sha_short }}-amd64 \
414- ${{ 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