1313
1414jobs :
1515 build :
16- runs-on : ubuntu-latest
16+ runs-on : ${{ matrix.runner }}
17+ strategy :
18+ matrix :
19+ include :
20+ - runner : ubuntu-latest
21+ platform : linux/amd64
22+ - runner : ubuntu-24.04-arm
23+ platform : linux/arm64
1724 steps :
1825 - name : Checkout
1926 uses : actions/checkout@v4
2027
21- - name : Set up QEMU
22- uses : docker/setup-qemu-action@v3.2.0
23-
2428 - name : Set up Docker Buildx
2529 uses : docker/setup-buildx-action@v3
2630
@@ -37,16 +41,64 @@ jobs:
3741 with :
3842 images : quay.io/ydrag0n/streambot
3943
40- - name : Build and push
41- id : build-and-push
44+ - name : Build and push by digest
45+ id : build
4246 uses : docker/build-push-action@v6
4347 with :
4448 context : .
4549 file : Dockerfile
46- platforms : linux/amd64,linux/arm64
47- push : true
48- tags : quay.io/ydrag0n/streambot:latest,quay.io/ydrag0n/streambot:${{ github.ref_name }}
50+ platforms : ${{ matrix.platform }}
4951 labels : ${{ steps.meta.outputs.labels }}
50- outputs : type=image,name=target
52+ outputs : type=image,name=quay.io/ydrag0n/streambot,push-by-digest=true,name-canonical=true,push=true
5153 cache-from : type=gha
52- cache-to : type=gha,mode=max
54+ cache-to : type=gha,mode=max
55+
56+ - name : Export digest
57+ run : |
58+ mkdir -p /tmp/digests
59+ digest="${{ steps.build.outputs.digest }}"
60+ touch "/tmp/digests/${digest#sha256:}"
61+
62+ - name : Upload digest
63+ uses : actions/upload-artifact@v4
64+ with :
65+ name : digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
66+ path : /tmp/digests/*
67+ if-no-files-found : error
68+ retention-days : 1
69+
70+ merge :
71+ runs-on : ubuntu-latest
72+ needs :
73+ - build
74+ steps :
75+ - name : Download digests
76+ uses : actions/download-artifact@v4
77+ with :
78+ path : /tmp/digests
79+ pattern : digests-*
80+ merge-multiple : true
81+
82+ - name : Set up Docker Buildx
83+ uses : docker/setup-buildx-action@v3
84+
85+ - name : Login to Quay.io
86+ uses : docker/login-action@v3
87+ with :
88+ registry : quay.io
89+ username : ${{ secrets.QUAY_USERNAME }}
90+ password : ${{ secrets.QUAY_ROBOT_TOKEN }}
91+
92+ - name : Extract Docker metadata
93+ id : meta
94+ uses : docker/metadata-action@v5.5.1
95+ with :
96+ images : quay.io/ydrag0n/streambot
97+
98+ - name : Create manifest list and push
99+ working-directory : /tmp/digests
100+ run : |
101+ docker buildx imagetools create \
102+ --tag quay.io/ydrag0n/streambot:latest \
103+ --tag quay.io/ydrag0n/streambot:${{ github.ref_name }} \
104+ $(printf 'quay.io/ydrag0n/streambot@sha256:%s ' *)
0 commit comments