2828 runs-on : ubuntu-latest
2929 outputs :
3030 validate-includes : ${{ steps.validate.outputs.matrix }}
31- artifact-includes : ${{ steps.artifact.outputs.matrix }}
3231 steps :
3332 -
3433 name : Checkout
4241 fields : platforms
4342 env :
4443 GOLANGCI_LINT_MULTIPLATFORM : 1
45- -
46- name : Artifact matrix
47- id : artifact
48- uses : docker/bake-action/subaction/matrix@v6
49- with :
50- target : artifact-all
51- fields : platforms
5244
5345 validate :
5446 runs-on : ubuntu-latest
@@ -128,62 +120,66 @@ jobs:
128120 with :
129121 sarif_file : ${{ env.DESTDIR }}/govulncheck.out
130122
131- artifact :
123+ artifacts :
124+ uses : docker/github-builder-experimental/.github/workflows/bake.yml@813ea76fdb0a744196f46fd25149937a6dbd42a2
125+ permissions :
126+ contents : read
127+ id-token : write # for signing attestation manifests and registry authentication if needed with GitHub OIDC Token
128+ packages : write # for pushing manifests to GHCR if needed (caller must provide the same permissions used in the reusable workflow)
129+ with :
130+ runner : amd64
131+ target : artifact-all
132+ output : local
133+ push : ${{ github.event_name != 'pull_request' }}
134+ artifact-name : diun
135+ bake-sbom : true
136+
137+ artifacts-finalize :
132138 runs-on : ubuntu-latest
133139 needs :
134- - prepare
135- - validate
136- strategy :
137- fail-fast : false
138- matrix :
139- include : ${{ fromJson(needs.prepare.outputs.artifact-includes) }}
140+ - artifacts
140141 steps :
141142 -
142- name : Prepare
143- run : |
144- platform=${{ matrix.platforms }}
145- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
146- -
147- name : Checkout
148- uses : actions/checkout@v6
149- with :
150- fetch-depth : 0
151- -
152- name : Set up QEMU
153- uses : docker/setup-qemu-action@v3
154- -
155- name : Set up Docker Buildx
156- uses : docker/setup-buildx-action@v3
157- -
158- name : Build
159- uses : docker/bake-action@v6
143+ name : Download artifacts
144+ uses : actions/download-artifact@v6
160145 with :
161- source : .
162- targets : artifact
163- provenance : mode=max
164- sbom : true
165- pull : true
166- set : |
167- *.platform=${{ matrix.platforms }}
146+ path : /tmp/buildx-output
147+ pattern : ${{ needs.artifacts.outputs.artifact-name }}*
148+ merge-multiple : true
168149 -
169150 name : Rename provenance and sbom
170- working-directory : ${{ env.DESTDIR }}/artifact
171151 run : |
172- binname=$(find . -name 'diun_*')
173- filename=$(basename "$binname" | sed -E 's/\.(tar\.gz|zip)$//')
174- mv "provenance.json" "${filename}.provenance.json"
175- mv "sbom-binary.spdx.json" "${filename}.sbom.json"
176- find . -name 'sbom*.json' -exec rm {} \;
152+ for pdir in /tmp/buildx-output/*/; do
153+ (
154+ cd "$pdir"
155+ binname=$(find . -name 'diun_*')
156+ filename=$(basename "$binname" | sed -E 's/\.(tar\.gz|zip)$//')
157+ mv "provenance.json" "${filename}.provenance.json"
158+ mv "sbom-binary.spdx.json" "${filename}.sbom.json"
159+ find . -name 'sbom*.json' -exec rm {} \;
160+ if [ -f "provenance.sigstore.json" ]; then
161+ mv "provenance.sigstore.json" "${filename}.provenance.sigstore.json"
162+ fi
163+ )
164+ done
165+ mkdir -p "${{ env.DESTDIR }}"
166+ mv /tmp/buildx-output/**/* "${{ env.DESTDIR }}/"
177167 -
178168 name : List artifacts
169+ working-directory : ${{ env.DESTDIR }}
170+ run : |
171+ tree -nh .
172+ -
173+ name : Check artifacts
174+ working-directory : ${{ env.DESTDIR }}
179175 run : |
180- tree -nh ${{ env.DESTDIR }}
176+ find . -type f -exec file -e ascii -- {} +
181177 -
182- name : Upload artifact
178+ name : Upload release binaries
183179 uses : actions/upload-artifact@v5
184180 with :
185- name : diun-${{ env.PLATFORM_PAIR }}
186- path : ${{ env.DESTDIR }}
181+ name : release
182+ path : ${{ env.DESTDIR }}/*
187183 if-no-files-found : error
188184
189185 release :
@@ -192,23 +188,18 @@ jobs:
192188 # required to create GitHub release
193189 contents : write
194190 needs :
195- - artifact
191+ - artifacts-finalize
196192 - test
197193 steps :
198194 -
199195 name : Checkout
200196 uses : actions/checkout@v6
201197 -
202- name : Download artifacts
198+ name : Download release binaries
203199 uses : actions/download-artifact@v6
204200 with :
205201 path : ${{ env.DESTDIR }}
206- pattern : diun-*
207- merge-multiple : true
208- -
209- name : List artifacts
210- run : |
211- tree -nh ${{ env.DESTDIR }}
202+ name : release
212203 -
213204 name : Set up Docker Buildx
214205 uses : docker/setup-buildx-action@v3
@@ -219,6 +210,11 @@ jobs:
219210 source : .
220211 targets : release
221212 provenance : false
213+ -
214+ name : List artifacts
215+ working-directory : ${{ env.DESTDIR }}/release
216+ run : |
217+ tree -nh .
222218 -
223219 name : GitHub Release
224220 uses : softprops/action-gh-release@v2
@@ -248,7 +244,7 @@ jobs:
248244 packages : write # for pushing manifests to GHCR if needed (caller must provide the same permissions used in the reusable workflow)
249245 needs :
250246 - image-prepare
251- - artifact
247+ - artifacts-finalize
252248 - test
253249 with :
254250 runner : amd64
0 commit comments