@@ -55,18 +55,67 @@ jobs:
5555 env :
5656 REPOSITORY : ${{ github.repository }}
5757
58- build :
59- name : Build Image
58+ build-amd64 :
59+ name : Build AMD64 Image
60+ runs-on : ubuntu-24.04
61+ permissions :
62+ contents : read
63+ packages : write
64+ needs : set-context
65+ steps :
66+ - uses : actions/checkout@v4
67+ if : needs.set-context.outputs.checkout-ref == 'pr'
68+ - uses : actions/checkout@v4
69+ if : needs.set-context.outputs.checkout-ref != 'pr'
70+ with :
71+ ref : ${{ needs.set-context.outputs.checkout-ref }}
72+ - name : Set up Docker Buildx
73+ uses : docker/setup-buildx-action@v3
74+ - name : Login to GitHub registry
75+ uses : docker/login-action@v3
76+ with :
77+ username : ${{ github.actor }}
78+ password : ${{ secrets.GITHUB_TOKEN }}
79+ registry : ghcr.io
80+ - name : Build and push by digest
81+ id : build
82+ uses : docker/build-push-action@v6
83+ with :
84+ context : .
85+ platforms : linux/amd64
86+ outputs : >-
87+ type=image,
88+ name=ghcr.io/${{ needs.set-context.outputs.repository-lc }},
89+ push-by-digest=true,
90+ name-canonical=true,
91+ push=true
92+ cache-from : >-
93+ type=gha,
94+ scope=build-amd64
95+ cache-to : >-
96+ type=gha,
97+ mode=max,
98+ scope=build-amd64
99+ - name : Export digest
100+ run : |
101+ mkdir -p /tmp/digests
102+ digest="${{ steps.build.outputs.digest }}"
103+ touch "/tmp/digests/${digest#sha256:}"
104+ - name : Upload digest
105+ uses : actions/upload-artifact@v4
106+ with :
107+ name : digests-amd64
108+ path : /tmp/digests/*
109+ if-no-files-found : error
110+ retention-days : 1
111+
112+ build-arm64 :
113+ name : Build ARM64 Image
60114 runs-on : ubuntu-24.04-arm
61115 permissions :
62116 contents : read
63117 packages : write
64118 needs : set-context
65- strategy :
66- matrix :
67- platform :
68- - linux/amd64
69- - linux/arm64
70119 steps :
71120 - uses : actions/checkout@v4
72121 if : needs.set-context.outputs.checkout-ref == 'pr'
87136 uses : docker/build-push-action@v6
88137 with :
89138 context : .
90- platforms : ${{ matrix.platform }}
139+ platforms : linux/arm64
91140 outputs : >-
92141 type=image,
93142 name=ghcr.io/${{ needs.set-context.outputs.repository-lc }},
@@ -96,11 +145,11 @@ jobs:
96145 push=true
97146 cache-from : >-
98147 type=gha,
99- scope=build-${{ strategy.job-index }}
148+ scope=build-arm64
100149 cache-to : >-
101150 type=gha,
102151 mode=max,
103- scope=build-${{ strategy.job-index }}
152+ scope=build-arm64
104153 - name : Export digest
105154 run : |
106155 mkdir -p /tmp/digests
@@ -109,7 +158,7 @@ jobs:
109158 - name : Upload digest
110159 uses : actions/upload-artifact@v4
111160 with :
112- name : digests-${{ strategy.job-index }}
161+ name : digests-arm64
113162 path : /tmp/digests/*
114163 if-no-files-found : error
115164 retention-days : 1
@@ -121,7 +170,8 @@ jobs:
121170 packages : write
122171 needs :
123172 - set-context
124- - build
173+ - build-amd64
174+ - build-arm64
125175 steps :
126176 - name : Download digests
127177 uses : actions/download-artifact@v4
0 commit comments