@@ -151,9 +151,30 @@ jobs:
151
151
152
152
deploy_docker :
153
153
name : Build and Upload the Speculos docker
154
- runs-on : ubuntu-latest
154
+ strategy :
155
+ matrix :
156
+ include :
157
+ - platform : linux/amd64
158
+ runner : ubuntu-latest
159
+ - platform : linux/arm64
160
+ runner : speculos-builder-2c-arm64-ubuntu_2404
161
+ runs-on : ${{ matrix.runner }}
155
162
needs : [build]
156
163
steps :
164
+
165
+ - name : Prepare
166
+ run : |
167
+ platform=${{ matrix.platform }}
168
+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
169
+
170
+ if [[ "${{ github.event_name }}" == 'push' && ( "${{ github.ref }}" == 'refs/heads/master' || "${{ github.ref }}" =~ '^refs/tags/.*' ) ]]; then
171
+ PUSH_FLAG='true'
172
+ else
173
+ PUSH_FLAG='false'
174
+ fi
175
+ echo "PUSH_FLAG=${PUSH_FLAG}" >> $GITHUB_ENV
176
+
177
+
157
178
- name : Clone
158
179
uses : actions/checkout@v4
159
180
with :
@@ -182,8 +203,57 @@ jobs:
182
203
password : ${{ secrets.GITHUB_TOKEN }}
183
204
184
205
- name : Build and publish to GitHub Packages
185
- uses : docker/build-push-action@v3
206
+ uses : docker/build-push-action@v6
207
+ id : buildPush
186
208
with :
187
- push : ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}
188
209
tags : ${{ steps.meta.outputs.tags }}
189
210
labels : ${{ steps.meta.outputs.labels }}
211
+ platforms : ${{ matrix.platform }}
212
+ outputs : type=image,name=ghcr.io/ledgerhq/speculos,push-by-digest=true,name-canonical=true,push=${{ env.PUSH_FLAG }}
213
+
214
+ - name : Export digest
215
+ run : |
216
+ mkdir -p /tmp/digests
217
+ digest="${{ steps.buildPush.outputs.digest }}"
218
+ touch "/tmp/digests/${digest#sha256:}"
219
+
220
+ - name : Upload digest
221
+ uses : actions/upload-artifact@v4
222
+ with :
223
+ name : digests-${{ env.PLATFORM_PAIR }}
224
+ path : /tmp/digests/*
225
+ if-no-files-found : error
226
+ retention-days : 1
227
+
228
+ final_tag_multiarch_merge_docker :
229
+ if : ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}
230
+ needs :
231
+ - deploy_docker
232
+ runs-on : ubuntu-latest
233
+ steps :
234
+ - name : Download digests
235
+ uses : actions/download-artifact@v4
236
+ with :
237
+ path : /tmp/digests
238
+ pattern : digests-*
239
+ merge-multiple : true
240
+
241
+ - name : Login to GitHub Container Registry
242
+ uses : docker/login-action@v3
243
+ with :
244
+ registry : ghcr.io
245
+ username : ${{ github.actor }}
246
+ password : ${{ secrets.GITHUB_TOKEN }}
247
+
248
+ - name : Set up Docker Buildx
249
+ uses : docker/setup-buildx-action@v3
250
+
251
+ - name : Create manifest list and push
252
+ working-directory : /tmp/digests
253
+ run : |
254
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
255
+ $(printf 'ghcr.io/ledgerhq/speculos@sha256:%s ' *)
256
+
257
+ - name : Inspect image
258
+ run : |
259
+ docker buildx imagetools inspect ghcr.io/ledgerhq/speculos:latest
0 commit comments