@@ -143,6 +143,7 @@ jobs:
143143 merge :
144144 runs-on : ubuntu-latest
145145 needs : [build]
146+ if : !cancelled()
146147 permissions :
147148 contents : read
148149 packages : write
@@ -168,23 +169,40 @@ jobs:
168169 echo "FULL_IMAGE_NAME=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
169170
170171 - name : Download digests
172+ id : download
171173 uses : actions/download-artifact@v5
172174 with :
173175 pattern : digests-${{ matrix.variant.name }}-*
174176 path : /tmp/digests
175177 merge-multiple : true
178+ continue-on-error : true
179+
180+ - name : Check digests
181+ id : check
182+ run : |
183+ count=$(find /tmp/digests -type f 2>/dev/null | wc -l | tr -d ' ')
184+ echo "digest_count=$count" >> $GITHUB_OUTPUT
185+ if [ "$count" -lt 2 ]; then
186+ echo "::warning::${{ matrix.variant.name }}: found $count digest(s), need 2 (one per arch). Skipping merge."
187+ echo "skip=true" >> $GITHUB_OUTPUT
188+ else
189+ echo "skip=false" >> $GITHUB_OUTPUT
190+ fi
176191
177192 - name : Set up Docker Buildx
193+ if : steps.check.outputs.skip != 'true'
178194 uses : docker/setup-buildx-action@v3
179195
180196 - name : Log in to the Container registry
197+ if : steps.check.outputs.skip != 'true'
181198 uses : docker/login-action@v3
182199 with :
183200 registry : ${{ env.REGISTRY }}
184201 username : ${{ github.actor }}
185202 password : ${{ secrets.GITHUB_TOKEN }}
186203
187204 - name : Extract metadata for Docker images
205+ if : steps.check.outputs.skip != 'true'
188206 id : meta
189207 uses : docker/metadata-action@v5
190208 with :
@@ -201,19 +219,23 @@ jobs:
201219 ${{ matrix.variant.suffix != '' && format('suffix={0},onlatest=true', matrix.variant.suffix) || '' }}
202220
203221 - name : Create manifest list and push
222+ if : steps.check.outputs.skip != 'true'
204223 working-directory : /tmp/digests
205224 run : |
206225 docker buildx imagetools create \
207226 $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
208227 $(printf '${{ env.FULL_IMAGE_NAME }}@sha256:%s ' *)
209228
210229 - name : Inspect image
230+ if : steps.check.outputs.skip != 'true'
211231 run : |
212232 docker buildx imagetools inspect ${{ env.FULL_IMAGE_NAME }}:${{ steps.meta.outputs.version }}
213233
214234 copy-to-dockerhub :
215235 runs-on : ubuntu-latest
216- if : github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
236+ if : >-
237+ !cancelled() &&
238+ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
217239 needs : [merge]
218240 continue-on-error : true
219241 strategy :
0 commit comments