91
91
platform :
92
92
- os : linux
93
93
arch : amd64
94
+ - os : linux
95
+ arch : arm64
94
96
steps :
95
97
- name : Checkout code
96
98
uses : actions/checkout@v3
@@ -170,4 +172,62 @@ jobs:
170
172
push : true
171
173
tags : ${{ steps.docker-metadata.outputs.tags }}
172
174
labels : ${{ steps.docker-metadata.outputs.labels }}
173
- platforms : linux/${{ matrix.platform.arch }}
175
+ platforms : linux/${{ matrix.platform.arch }}
176
+ outputs : type=image,push-by-digest=true,name-canonical=true,push=true
177
+
178
+ - name : Export digest
179
+ run : |
180
+ mkdir -p ${{ runner.temp }}/digests
181
+ digest="${{ steps.build.outputs.digest }}"
182
+ touch "${{ runner.temp }}/digests/${digest#sha256:}"
183
+
184
+ - name : Upload digest
185
+ uses : actions/upload-artifact@v4
186
+ with :
187
+ name : digests--${{ matrix.platform.arch }}
188
+ path : ${{ runner.temp }}/digests/*
189
+ if-no-files-found : error
190
+ retention-days : 1
191
+
192
+ merge :
193
+ runs-on : ubuntu-latest
194
+ needs :
195
+ - build-alpine-docker
196
+ steps :
197
+ - name : Download digests
198
+ uses : actions/download-artifact@v4
199
+ with :
200
+ path : ${{ runner.temp }}/digests
201
+ pattern : digests-*
202
+ merge-multiple : true
203
+
204
+ - name : Login to Docker Hub
205
+ uses : docker/login-action@v3
206
+ with :
207
+ registry : ghcr.io
208
+ username : ${{ secrets.GHCR_LOGIN }}
209
+ password : ${{ secrets.GHCR_PASSWORD }}
210
+
211
+ - name : Set up Docker Buildx
212
+ uses : docker/setup-buildx-action@v3
213
+
214
+ - name : Docker meta
215
+ id : meta
216
+ uses : docker/metadata-action@v5
217
+ with :
218
+ images : ghcr.io/context-hub/ctx
219
+ tags : |
220
+ type=ref,event=branch
221
+ type=ref,event=pr
222
+ type=semver,pattern={{version}}
223
+ type=semver,pattern={{major}}.{{minor}}
224
+
225
+ - name : Create manifest list and push
226
+ working-directory : ${{ runner.temp }}/digests
227
+ run : |
228
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
229
+ $(printf 'ghcr.io/context-hub/ctx@sha256:%s ' *)
230
+
231
+ - name : Inspect image
232
+ run : |
233
+ docker buildx imagetools inspect ghcr.io/context-hub/ctx:${{ steps.meta.outputs.version }}
0 commit comments