Skip to content

Commit 9dc7f1e

Browse files
crazy-maxndeloof
authored andcommitted
ci: use docker/github-builder to build, sign and push bin image
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent 0320512 commit 9dc7f1e

File tree

2 files changed

+47
-53
lines changed

2 files changed

+47
-53
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,24 @@ jobs:
109109
path: ./bin/release/*
110110
if-no-files-found: error
111111

112+
bin-image-test:
113+
if: github.event_name == 'pull_request'
114+
uses: docker/github-builder/.github/workflows/bake.yml@v1
115+
with:
116+
runner: amd64
117+
target: image-cross
118+
cache: true
119+
cache-scope: bin-image-test
120+
output: image
121+
push: false
122+
sbom: true
123+
set-meta-labels: true
124+
meta-images: |
125+
compose-bin
126+
meta-tags: |
127+
type=ref,event=pr
128+
meta-bake-target: meta-helper
129+
112130
test:
113131
runs-on: ubuntu-latest
114132
steps:

.github/workflows/merge.yml

Lines changed: 29 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -74,63 +74,39 @@ jobs:
7474
run: |
7575
make e2e-compose-standalone
7676
77-
bin-image:
78-
runs-on: ubuntu-22.04
77+
bin-image-prepare:
78+
runs-on: ubuntu-24.04
7979
outputs:
80-
digest: ${{ fromJSON(steps.bake.outputs.metadata).image-cross['containerimage.digest'] }}
80+
repo-slug: ${{ env.REPO_SLUG }}
8181
steps:
82-
-
83-
name: Free disk space
84-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
85-
with:
86-
android: true
87-
dotnet: true
88-
haskell: true
89-
large-packages: true
90-
swap-storage: true
91-
-
92-
name: Checkout
93-
uses: actions/checkout@v4
94-
-
95-
name: Login to DockerHub
96-
if: github.event_name != 'pull_request'
97-
uses: docker/login-action@v3
98-
with:
82+
# FIXME: can't use env object in reusable workflow inputs: https://github.com/orgs/community/discussions/26671
83+
- run: echo "Exposing env vars for reusable workflow"
84+
85+
bin-image:
86+
uses: docker/github-builder/.github/workflows/bake.yml@v1
87+
permissions:
88+
contents: read # same as global permission
89+
id-token: write # for signing attestation(s) with GitHub OIDC Token
90+
with:
91+
runner: amd64
92+
target: image-cross
93+
cache: true
94+
cache-scope: bin-image
95+
output: image
96+
push: ${{ github.event_name != 'pull_request' }}
97+
sbom: true
98+
set-meta-labels: true
99+
meta-images: |
100+
${{ needs.bin-image-prepare.outputs.repo-slug }}
101+
meta-tags: |
102+
type=ref,event=tag
103+
type=edge
104+
meta-bake-target: meta-helper
105+
secrets:
106+
registry-auths: |
107+
- registry: docker.io
99108
username: ${{ secrets.DOCKERPUBLICBOT_USERNAME }}
100109
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
101-
-
102-
name: Set up QEMU
103-
uses: docker/setup-qemu-action@v3
104-
-
105-
name: Set up Docker Buildx
106-
uses: docker/setup-buildx-action@v3
107-
-
108-
name: Docker meta
109-
id: meta
110-
uses: docker/metadata-action@v5
111-
with:
112-
images: |
113-
${{ env.REPO_SLUG }}
114-
tags: |
115-
type=ref,event=tag
116-
type=edge
117-
bake-target: meta-helper
118-
-
119-
name: Build and push image
120-
uses: docker/bake-action@v6
121-
id: bake
122-
with:
123-
source: .
124-
files: |
125-
./docker-bake.hcl
126-
${{ steps.meta.outputs.bake-file }}
127-
targets: image-cross
128-
push: ${{ github.event_name != 'pull_request' }}
129-
sbom: true
130-
provenance: mode=max
131-
set: |
132-
*.cache-from=type=gha,scope=bin-image
133-
*.cache-to=type=gha,scope=bin-image,mode=max
134110
135111
desktop-edge-test:
136112
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)