@@ -346,64 +346,73 @@ jobs:
346346 with :
347347 sarif_file : ${{ env.DESTDIR }}/govulncheck.out
348348
349- prepare-binaries :
349+ binaries :
350+ uses : docker/github-builder-experimental/.github/workflows/bake.yml@8fc70909404a502fd0eca6601b99b32fa7192b03
351+ permissions :
352+ contents : read # same as global permission
353+ id-token : write # for signing attestation(s) with GitHub OIDC Token
354+ with :
355+ runner : amd64
356+ target : release
357+ output : local
358+ push : ${{ github.event_name != 'pull_request' }}
359+ artifact-name : buildx
360+ cache : true
361+ cache-scope : binaries
362+ bake-sbom : true
363+
364+ binaries-finalize :
350365 runs-on : ubuntu-24.04
351- outputs :
352- matrix : ${{ steps.platforms.outputs.matrix }}
366+ needs :
367+ - binaries
353368 steps :
354369 -
355- name : Checkout
356- uses : actions/checkout@v6
370+ name : Download artifacts
371+ uses : actions/download-artifact@v6
372+ with :
373+ path : /tmp/buildx-output
374+ pattern : ${{ needs.binaries.outputs.artifact-name }}*
375+ merge-multiple : true
357376 -
358- name : Create matrix
359- id : platforms
377+ name : Rename provenance and sbom
360378 run : |
361- echo "matrix=$(docker buildx bake binaries-cross --print | jq -cr '.target."binaries-cross".platforms')" >>${GITHUB_OUTPUT}
379+ for pdir in /tmp/buildx-output/*/; do
380+ (
381+ cd "$pdir"
382+ binname=$(find . -name 'buildx-*')
383+ filename=$(basename "${binname%.exe}")
384+ mv "provenance.json" "${filename}.provenance.json"
385+ mv "sbom-binaries.spdx.json" "${filename}.sbom.json"
386+ find . -name 'sbom*.json' -exec rm {} \;
387+ if [ -f "provenance.sigstore.json" ]; then
388+ mv "provenance.sigstore.json" "${filename}.provenance.sigstore.json"
389+ fi
390+ )
391+ done
392+ mkdir -p "${{ env.DESTDIR }}"
393+ mv /tmp/buildx-output/**/* "${{ env.DESTDIR }}/"
362394 -
363- name : Show matrix
395+ name : Create checksums
396+ working-directory : ${{ env.DESTDIR }}
364397 run : |
365- echo ${{ steps.platforms.outputs.matrix }}
366-
367- binaries :
368- runs-on : ubuntu-24.04
369- needs :
370- - prepare-binaries
371- strategy :
372- fail-fast : false
373- matrix :
374- platform : ${{ fromJson(needs.prepare-binaries.outputs.matrix) }}
375- steps :
398+ sha256sum -b buildx-* > ./checksums.txt
399+ sed -i '/darwin/d' ./checksums.txt
400+ sha256sum -c --strict checksums.txt
376401 -
377- name : Prepare
402+ name : List artifacts
403+ working-directory : ${{ env.DESTDIR }}
378404 run : |
379- platform=${{ matrix.platform }}
380- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
381- -
382- name : Checkout
383- uses : actions/checkout@v6
405+ tree -nh .
384406 -
385- name : Set up QEMU
386- uses : docker/setup-qemu-action@v3
387- -
388- name : Set up Docker Buildx
389- uses : docker/setup-buildx-action@v3
390- with :
391- version : ${{ env.SETUP_BUILDX_VERSION }}
392- driver-opts : image=${{ env.SETUP_BUILDKIT_IMAGE }}
393- buildkitd-flags : --debug
394- -
395- name : Build
407+ name : Check artifacts
408+ working-directory : ${{ env.DESTDIR }}
396409 run : |
397- make release
398- env :
399- PLATFORMS : ${{ matrix.platform }}
400- CACHE_FROM : type=gha,scope=binaries-${{ env.PLATFORM_PAIR }}
401- CACHE_TO : type=gha,scope=binaries-${{ env.PLATFORM_PAIR }},mode=max
410+ find . -type f -exec file -e ascii -- {} +
402411 -
403- name : Upload artifacts
412+ name : Upload release binaries
404413 uses : actions/upload-artifact@v5
405414 with :
406- name : buildx-${{ env.PLATFORM_PAIR }}
415+ name : release
407416 path : ${{ env.DESTDIR }}/*
408417 if-no-files-found : error
409418
@@ -486,29 +495,14 @@ jobs:
486495 needs :
487496 - test-integration
488497 - test-unit
489- - binaries
498+ - binaries-finalize
490499 steps :
491500 -
492- name : Checkout
493- uses : actions/checkout@v6
494- -
495- name : Download binaries
501+ name : Download release binaries
496502 uses : actions/download-artifact@v6
497503 with :
498504 path : ${{ env.DESTDIR }}
499- pattern : buildx-*
500- merge-multiple : true
501- -
502- name : Create checksums
503- run : ./hack/hash-files
504- -
505- name : List artifacts
506- run : |
507- tree -nh ${{ env.DESTDIR }}
508- -
509- name : Check artifacts
510- run : |
511- find ${{ env.DESTDIR }} -type f -exec file -e ascii -- {} +
505+ name : release
512506 -
513507 name : GitHub Release
514508 if : startsWith(github.ref, 'refs/tags/v')
0 commit comments