@@ -15,16 +15,17 @@ jobs:
1515 fail-fast : false
1616 matrix :
1717 ubuntu : [focal, jammy, noble]
18- platform : [linux/amd64]
18+ platform : [linux/amd64, linux/arm64 ]
1919
2020 name : Build container images for GHCR
2121 runs-on : ubuntu-latest
2222 steps :
23- - uses : actions/checkout@v3
23+ - name : Checkout
24+ uses : actions/checkout@v4
2425
2526 - name : Extract metadata for container image
2627 id : meta
27- uses : docker/metadata-action@v4
28+ uses : docker/metadata-action@v5
2829 with :
2930 images : ghcr.io/${{ github.repository }}
3031 tags : |
@@ -36,32 +37,33 @@ jobs:
3637 echo container=$(echo '${{ steps.meta.outputs.tags }}' | awk -F':' '{print $1}') >> $GITHUB_OUTPUT
3738
3839 - name : Set up QEMU
39- uses : docker/setup-qemu-action@v2
40+ uses : docker/setup-qemu-action@v3
4041 with :
4142 platforms : arm64
42- if : contains(steps.versions.outputs .platform, 'arm64')
43+ if : contains(matrix .platform, 'arm64')
4344
4445 - name : Set up Docker Buildx
45- uses : docker/setup-buildx-action@v2
46+ uses : docker/setup-buildx-action@v3
4647 with :
4748 platforms : ${{matrix.platform}}
4849
4950 - name : Login to GHCR
50- uses : docker/login-action@v2
51+ uses : docker/login-action@v3
5152 with :
5253 registry : ghcr.io
5354 username : ${{ github.repository_owner }}
5455 password : ${{ secrets.GITHUB_TOKEN }}
5556
5657 - name : Build and push container image to ghcr
5758 id : build
58- uses : docker/build-push-action@v4
59+ uses : docker/build-push-action@v6
5960 with :
6061 context : ${{matrix.ubuntu}}
6162 labels : ${{ steps.meta.outputs.labels }}
6263 outputs : type=image,name=${{ steps.vars.outputs.container }},push-by-digest=true,name-canonical=true,push=true
6364 platforms : ${{matrix.platform}}
6465 provenance : false
66+ no-cache : true
6567
6668 - name : Prepare Dockerfile to extract R version with emulator
6769 run : |
7476 EOF
7577
7678 - name : Build and push container image to ghcr
77- uses : docker/build-push-action@v4
79+ uses : docker/build-push-action@v6
7880 with :
7981 file : ${{matrix.ubuntu}}-${{matrix.platform}}-r.Dockerfile
8082 context : .
@@ -130,20 +132,137 @@ jobs:
130132 path : /tmp/digests
131133
132134 - name : Set up Docker Buildx
133- uses : docker/setup-buildx-action@v2
135+ uses : docker/setup-buildx-action@v3
134136 with :
135137 platforms : ${{matrix.platform}}
136138
137139 - name : Login to GHCR
138- uses : docker/login-action@v2
140+ uses : docker/login-action@v3
139141 with :
140142 registry : ghcr.io
141143 username : ${{ github.repository_owner }}
142144 password : ${{ secrets.GITHUB_TOKEN }}
143145
144146 - name : Extract metadata for container image
145147 id : meta
146- uses : docker/metadata-action@v4
148+ uses : docker/metadata-action@v5
149+ with :
150+ images : ghcr.io/${{ github.repository }}
151+ tags : |
152+ type=raw,value=${{ matrix.ubuntu }}
153+
154+ - name : Extract container name without tag
155+ id : vars
156+ run : |
157+ echo container=$(echo '${{ steps.meta.outputs.tags }}' | awk -F':' '{print $1}') >> $GITHUB_OUTPUT
158+
159+ - name : Create manifest list and push
160+ run : |
161+ cd /tmp/digests
162+ ls --hide=digestdirs > digestdirs
163+ cat digestdirs | xargs -i bash -c 'docker buildx imagetools create -t ${{steps.vars.outputs.container}}:{} $(for f in {}/*; do basename "$f"; done | xargs printf "${{steps.vars.outputs.container}}@sha256:%s ")'
164+
165+ ghcrbuild_ci :
166+ needs : ghcrbuild
167+ strategy :
168+ fail-fast : false
169+ matrix :
170+ ubuntu : [noble_ci]
171+ platform : [linux/amd64, linux/arm64]
172+
173+ name : Build CI container images for GHCR
174+ runs-on : ubuntu-latest
175+ steps :
176+ - name : Checkout
177+ uses : actions/checkout@v4
178+
179+ - name : Extract metadata for container image
180+ id : meta
181+ uses : docker/metadata-action@v5
182+ with :
183+ images : ghcr.io/${{ github.repository }}
184+ tags : |
185+ type=raw,value=${{ matrix.ubuntu }}
186+
187+ - name : Extract container name without tag
188+ id : vars
189+ run : |
190+ echo container=$(echo '${{ steps.meta.outputs.tags }}' | awk -F':' '{print $1}') >> $GITHUB_OUTPUT
191+
192+ - name : Set up QEMU
193+ uses : docker/setup-qemu-action@v3
194+ with :
195+ platforms : arm64
196+ if : contains(matrix.platform, 'arm64')
197+
198+ - name : Set up Docker Buildx
199+ uses : docker/setup-buildx-action@v3
200+ with :
201+ platforms : ${{matrix.platform}}
202+
203+ - name : Login to GHCR
204+ uses : docker/login-action@v3
205+ with :
206+ registry : ghcr.io
207+ username : ${{ github.repository_owner }}
208+ password : ${{ secrets.GITHUB_TOKEN }}
209+
210+ - name : Build and push container image to ghcr
211+ id : build
212+ uses : docker/build-push-action@v6
213+ with :
214+ context : ${{matrix.ubuntu}}
215+ labels : ${{ steps.meta.outputs.labels }}
216+ outputs : type=image,name=${{ steps.vars.outputs.container }},push-by-digest=true,name-canonical=true,push=true
217+ platforms : ${{matrix.platform}}
218+ provenance : false
219+ no-cache : true
220+
221+ - name : Export digest
222+ run : |
223+ digest="${{ steps.build.outputs.digest }}"
224+ mkdir -p /tmp/digests/${{matrix.ubuntu}}
225+ touch "/tmp/digests/${{matrix.ubuntu}}/${digest#sha256:}"
226+
227+ - name : Upload digests
228+ uses : actions/upload-artifact@v4
229+ with :
230+ name : r2udigests-${{matrix.ubuntu}}-${{ github.run_id }}
231+ path : /tmp/digests/**
232+ if-no-files-found : error
233+ retention-days : 1
234+
235+ merge_ci :
236+ runs-on : ubuntu-latest
237+ needs :
238+ - ghcrbuild_ci
239+ if : always()
240+ strategy :
241+ fail-fast : false
242+ matrix :
243+ ubuntu : [noble_ci]
244+ steps :
245+ - name : Download digests
246+ uses : actions/download-artifact@v4
247+ with :
248+ name : r2udigests-${{matrix.ubuntu}}-${{ github.run_id }}
249+ path : /tmp/digests
250+
251+ - name : Set up Docker Buildx
252+ uses : docker/setup-buildx-action@v3
253+ with :
254+ platforms : ${{matrix.platform}}
255+
256+ - name : Login to GHCR
257+ uses : docker/login-action@v3
258+ with :
259+ registry : ghcr.io
260+ username : ${{ github.repository_owner }}
261+ password : ${{ secrets.GITHUB_TOKEN }}
262+
263+ - name : Extract metadata for container image
264+ id : meta
265+ uses : docker/metadata-action@v5
147266 with :
148267 images : ghcr.io/${{ github.repository }}
149268 tags : |
0 commit comments