1616 include :
1717 - platform : linux/amd64
1818 runner : ubuntu-latest
19+ suffix : amd64
1920 - platform : linux/arm64
2021 runner : ubuntu-24.04-arm
22+ suffix : arm64
2123 permissions :
2224 contents : read
2325 packages : write
2830 - uses : docker/setup-buildx-action@v3
2931
3032 - uses : docker/login-action@v3
31- if : github.event_name != 'pull_request'
3233 with :
3334 registry : ${{ env.REGISTRY }}
3435 username : ${{ github.actor }}
@@ -38,49 +39,29 @@ jobs:
3839 id : meta
3940 with :
4041 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+ tags : |
43+ type=semver,pattern={{version}},suffix=-${{ matrix.suffix }}
44+ type=sha,suffix=-${{ matrix.suffix }}
4145
4246 - uses : docker/build-push-action@v6
43- id : build
4447 with :
4548 context : .
4649 platforms : ${{ matrix.platform }}
50+ push : true
51+ tags : ${{ steps.meta.outputs.tags }}
4752 labels : ${{ steps.meta.outputs.labels }}
48- outputs : type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
53+ provenance : false
4954 cache-from : type=gha,scope=${{ matrix.platform }}
5055 cache-to : type=gha,mode=max,scope=${{ matrix.platform }}
5156
52- - name : Export digest
53- if : github.event_name != 'pull_request'
54- run : |
55- mkdir -p /tmp/digests
56- digest="${{ steps.build.outputs.digest }}"
57- touch "/tmp/digests/${digest#sha256:}"
58-
59- - name : Upload digest
60- if : github.event_name != 'pull_request'
61- uses : actions/upload-artifact@v4
62- with :
63- name : digests-${{ matrix.runner }}
64- path : /tmp/digests/*
65- if-no-files-found : error
66- retention-days : 1
67-
68- merge :
57+ manifest :
6958 runs-on : ubuntu-latest
70- if : github.event_name != 'pull_request'
7159 needs : build
7260 permissions :
7361 contents : read
7462 packages : write
7563
7664 steps :
77- - name : Download digests
78- uses : actions/download-artifact@v4
79- with :
80- path : /tmp/digests
81- pattern : digests-*
82- merge-multiple : true
83-
8465 - uses : docker/setup-buildx-action@v3
8566
8667 - uses : docker/login-action@v3
@@ -94,14 +75,15 @@ jobs:
9475 with :
9576 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
9677 tags : |
97- type=ref,event=branch
9878 type=semver,pattern={{version}}
9979 type=semver,pattern={{major}}.{{minor}}
100- type=sha
80+ type=raw,value=latest
10181
102- - name : Create manifest list and push
103- working-directory : /tmp/digests
82+ - name : Create and push manifest
10483 run : |
105- docker buildx imagetools create \
106- $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
107- $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
84+ version="${GITHUB_REF#refs/tags/v}"
85+ for tag in $(jq -cr '.tags[]' <<< "$DOCKER_METADATA_OUTPUT_JSON"); do
86+ docker buildx imagetools create -t "$tag" \
87+ "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${version}-amd64" \
88+ "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${version}-arm64"
89+ done
0 commit comments