@@ -124,15 +124,46 @@ jobs:
124124 type=semver,pattern={{major}}
125125 - name : Create manifest list and push
126126 working-directory : ${{ runner.temp }}/digests
127- shell : bash
127+ shell : python
128128 run : |
129- set -xEeuo pipefail
129+ import os
130+ import json
131+ import subprocess
130132
131- # shellcheck disable=SC2046
132- docker buildx imagetools create \
133- $(echo '${{ steps.metadata.outputs.json }}' | jq -cr '.annotations | map("--annotation \"" + . + "\"") | join(" ")') \
134- $(echo '${{ steps.metadata.outputs.json }}' | jq -cr '.tags | map("--tag \"" + . + "\"") | join(" ")') \
135- $(printf '${{ env.REGISTRY }}/${{ github.repository }}-${{ inputs.flavor }}@sha256:%s ' *)
133+ metadata = json.loads('${{ steps.metadata.outputs.metadata }}')
134+
135+ annotations = []
136+ for ann in metadata.get('annotations', []):
137+ annotations.extend(['--annotation', ann])
138+
139+ tags = []
140+ for tag in metadata.get('tags', []):
141+ tags.extend(['--tag', tag])
142+
143+ # Collect all digest files in the current directory
144+ digests = []
145+ for f in os.listdir('.'):
146+ if f.startswith('sha256:') or len(f) == 64:
147+ digests.append(f)
148+
149+ if not digests:
150+ raise RuntimeError("No digest files found in the current directory.")
151+
152+ # Compose image references
153+ image_refs = [
154+ f"{${{ env.REGISTRY }}/${{ github.repository }}-${{ inputs.flavor }}@sha256:{digest}"
155+ for digest in digests
156+ ]
157+
158+ cmd = [
159+ 'docker', 'buildx', 'imagetools', 'create',
160+ *annotations,
161+ *tags,
162+ *image_refs
163+ ]
164+
165+ print(' '.join(cmd))
166+ subprocess.run(cmd, check=True)
136167 - name : Inspect manifest and extract digest
137168 id : inspect-manifest
138169 run : |
0 commit comments