6868
6969 print(f"Merged digests:\n{json.dumps(merged, indent=2)}", flush=True)
7070
71- with open(os.environ["GITHUB_OUTPUT"], "a") as gh:
72- gh.write(f"image-digests={json.dumps(merged)}\n")
73-
7471 # --- Load bake metadata ---
7572 with open(bake_meta_path) as f:
7673 bake_meta = json.load(f)
@@ -84,13 +81,26 @@ runs:
8481 subprocess.run(cmd, check=True)
8582
8683 # --- Create manifest lists, push & inspect ---
84+ image_digests = []
8785 for entry in merged.values():
8886 image_name = entry["name"]
8987 digests = [f"{image_name}@{d}" for d in entry["digests"]]
9088 tag_args = [a for s in tag_suffixes for a in ("-t", f"{image_name}:{s}")]
91- run(["docker", "buildx", "imagetools", "create"] + tag_args + digests)
89+ run(["docker", "buildx", "imagetools", "create", * tag_args, * digests] )
9290 if version:
93- run(["docker", "buildx", "imagetools", "inspect", f"{image_name}:{version}"])
91+ ref = f"{image_name}:{version}"
92+ result = subprocess.run(
93+ ["docker", "buildx", "imagetools", "inspect", ref,
94+ "--format", "{{.Manifest.Digest}}"],
95+ capture_output=True, text=True, check=True,
96+ )
97+ digest = result.stdout.strip()
98+ print(f"{ref} -> {digest}", flush=True)
99+ image_digests.append({image_name: digest})
94100
95101 if not version:
96102 print("WARNING: DOCKER_META_VERSION not found, skipping inspect")
103+
104+ print(f"\nimage-digests:\n{json.dumps(image_digests, indent=2)}", flush=True)
105+ with open(os.environ["GITHUB_OUTPUT"], "a") as gh:
106+ gh.write(f"image-digests={json.dumps(image_digests)}\n")
0 commit comments