@@ -63,16 +63,12 @@ jobs:
6363 with :
6464 password : ${{ secrets.PYPI_API_TOKEN }}
6565
66- docker_build_by_platform :
67- name : Build image per -arch and push by digest (${{ matrix.platform }})
66+ docker_build_push :
67+ name : Build & push multi -arch image
6868 runs-on : ubuntu-latest
6969 permissions :
7070 contents : read
7171 packages : write
72- strategy :
73- fail-fast : false
74- matrix :
75- platform : [linux/amd64, linux/arm64]
7672 steps :
7773 - uses : actions/checkout@v5
7874 - name : Extract version from tag
8581 registry : ${{ env.REGISTRY }}
8682 username : ${{ github.actor }}
8783 password : ${{ secrets.GITHUB_TOKEN }}
88- - name : Set up QEMU
89- uses : docker/setup-qemu-action@v3
90- - name : Set up Docker Buildx
91- uses : docker/setup-buildx-action@v3
9284 - id : meta
9385 uses : docker/metadata-action@v5
9486 with :
@@ -97,76 +89,19 @@ jobs:
9789 type=ref,event=tag
9890 type=semver,pattern={{version}}
9991 type=semver,pattern={{major}}.{{minor}}
100- type=semver,pattern={{major}}
10192 type=raw,value=latest,enable={{is_default_branch}}
102- - name : Build and push by digest (${{ matrix.platform }})
103- id : build
104- uses : docker/build-push-action@v6
93+ - uses : docker/setup-buildx-action@v3
94+ - uses : docker/build-push-action@v6
10595 with :
10696 context : .
107- platforms : ${{ matrix.platform }}
97+ platforms : linux/amd64,linux/arm64
98+ push : true
99+ tags : ${{ steps.meta.outputs.tags }}
100+ labels : ${{ steps.meta.outputs.labels }}
108101 build-args : |
109102 VERSION=${{ steps.ver.outputs.VERSION }}
110- labels : ${{ steps.meta.outputs.labels }}
111- tags : ${{ steps.meta.outputs.tags }}
112- outputs : type=image,push-by-digest=true,name-canonical=true,push=true
113- cache-from : |
114- type=gha
115- cache-to : |
116- type=gha,mode=max
117- provenance : false
118- sbom : false
119- - name : Export digest
120- run : |
121- mkdir -p "${{ runner.temp }}/digests"
122- digest="${{ steps.build.outputs.digest }}"
123- touch "${{ runner.temp }}/digests/${digest#sha256:}"
124- - name : Upload digest
125- uses : actions/upload-artifact@v4
126- with :
127- name : digests-${{ matrix.platform }}
128- path : ${{ runner.temp }}/digests/*
129- if-no-files-found : error
130- retention-days : 1
131-
132- docker_merge_manifest :
133- name : Create and push multi-arch manifest
134- runs-on : ubuntu-latest
135- needs : docker_build_by_platform
136- permissions :
137- contents : read
138- packages : write
139- steps :
140- - uses : docker/login-action@v3
141- with :
142- registry : ${{ env.REGISTRY }}
143- username : ${{ github.actor }}
144- password : ${{ secrets.GITHUB_TOKEN }}
145- - uses : docker/setup-buildx-action@v3
146- - id : meta
147- uses : docker/metadata-action@v5
148- with :
149- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
150- tags : |
151- type=ref,event=tag
152- type=semver,pattern={{version}}
153- type=semver,pattern={{major}}.{{minor}}
154- type=semver,pattern={{major}}
155- type=raw,value=latest,enable={{is_default_branch}}
156- - name : Download digests
157- uses : actions/download-artifact@v4
158- with :
159- path : ${{ runner.temp }}/digests
160- pattern : digests-*
161- merge-multiple : true
162- - name : Create manifest list and push
163- working-directory : ${{ runner.temp }}/digests
164- run : |
165- docker buildx imagetools create \
166- $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "${DOCKER_METADATA_OUTPUT_JSON}") \
167- $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
168- - name : Inspect image
169- run : docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
103+ cache-from : type=gha
104+ cache-to : type=gha,mode=max
170105
171106 create_release :
172107 name : Create GitHub Release with artifacts
0 commit comments