@@ -407,68 +407,45 @@ jobs:
407407 path : ${{ env.DESTDIR }}/*
408408 if-no-files-found : error
409409
410- bin-image :
410+ bin-image-prepare :
411411 runs-on : ubuntu-24.04
412+ outputs :
413+ repo-slug : ${{ env.REPO_SLUG }}
414+ steps :
415+ # FIXME: can't use env object in reusable workflow inputs: https://github.com/orgs/community/discussions/26671
416+ - run : echo "Exposing env vars for reusable workflow"
417+
418+ bin-image :
419+ if : ${{ github.repository == 'docker/buildx' }}
420+ uses : docker/github-builder-experimental/.github/workflows/bake.yml@main
412421 needs :
422+ - bin-image-prepare
413423 - test-integration
414424 - test-unit
415- if : ${{ github.event_name != 'pull_request' && github.repository == 'docker/buildx' }}
416- steps :
417- -
418- name : Free disk space
419- uses : jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
420- with :
421- android : true
422- dotnet : true
423- haskell : true
424- large-packages : true
425- swap-storage : true
426- -
427- name : Checkout
428- uses : actions/checkout@v5
429- -
430- name : Set up QEMU
431- uses : docker/setup-qemu-action@v3
432- -
433- name : Set up Docker Buildx
434- uses : docker/setup-buildx-action@v3
435- with :
436- version : ${{ env.SETUP_BUILDX_VERSION }}
437- driver-opts : image=${{ env.SETUP_BUILDKIT_IMAGE }}
438- buildkitd-flags : --debug
439- -
440- name : Docker meta
441- id : meta
442- uses : docker/metadata-action@v5
443- with :
444- images : |
445- ${{ env.REPO_SLUG }}
446- tags : |
447- type=ref,event=branch
448- type=ref,event=pr
449- type=semver,pattern={{version}}
450- bake-target : meta-helper
451- -
452- name : Login to DockerHub
453- if : github.event_name != 'pull_request'
454- uses : docker/login-action@v3
455- with :
425+ permissions :
426+ contents : read
427+ id-token : write # for signing attestation manifests with GitHub OIDC Token
428+ packages : write # only used if pushing to GHCR but needs to be defined as caller must provide permissions ≥ to those used in the reusable workflow
429+ with :
430+ runs-on : ubuntu-24.04
431+ target : image-cross
432+ output : ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
433+ cache : true
434+ cache-scope : bin-image
435+ set-meta-labels : true
436+ meta-images : |
437+ ${{ needs.bin-image-prepare.outputs.repo-slug }}
438+ meta-tags : |
439+ type=ref,event=branch
440+ type=ref,event=pr
441+ type=semver,pattern={{version}}
442+ meta-bake-target : meta-helper
443+ bake-sbom : true
444+ secrets :
445+ registry-auths : |
446+ - registry: docker.io
456447 username: ${{ vars.DOCKERPUBLICBOT_USERNAME }}
457448 password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
458- -
459- name : Build and push image
460- uses : docker/bake-action@v6
461- with :
462- source : .
463- files : |
464- ./docker-bake.hcl
465- ${{ steps.meta.outputs.bake-file }}
466- targets : image-cross
467- push : ${{ github.event_name != 'pull_request' }}
468- sbom : true
469- set : |
470- *.cache-from=type=gha,scope=bin-image
471- *.cache-to=type=gha,scope=bin-image,mode=max
472449
473450 scout :
474451 runs-on : ubuntu-24.04
0 commit comments