@@ -91,32 +91,22 @@ jobs:
9191
9292 - name : Create and push manifest list
9393 run : |
94+ set -euo pipefail
9495 IMAGE=ghcr.io/${{ needs.build.outputs.image_name }}
9596 SHA_TAG=${{ needs.build.outputs.sha_tag }}
9697 DATE_TAG=${{ needs.build.outputs.date_tag }}
9798 USER_TAG=${{ needs.build.outputs.user_tag }}
9899
99- # Create and push the sha tag manifest
100- docker manifest create $IMAGE:$SHA_TAG \
101- $IMAGE:$SHA_TAG
102- docker manifest push $IMAGE:$SHA_TAG
103-
104- # Create and push the date tag
105- docker manifest create $IMAGE:$DATE_TAG \
106- $IMAGE:$SHA_TAG
107- docker manifest push $IMAGE:$DATE_TAG
108-
109- # Create and push the latest tag
110- docker manifest create $IMAGE:latest \
111- $IMAGE:$SHA_TAG
112- docker manifest push $IMAGE:latest
113-
114- # Create and push the user-provided tag (if any)
100+ # Re-tag the already-built image/manifest (single-arch or multi-arch) using imagetools.
101+ # This avoids attempting to create a manifest from an existing manifest list (which caused the failure).
102+ ARGS=(-t "$IMAGE:$DATE_TAG" -t "$IMAGE:latest")
115103 if [ -n "$USER_TAG" ]; then
116- docker manifest create $IMAGE:$USER_TAG \
117- $IMAGE:$SHA_TAG
118- docker manifest push $IMAGE:$USER_TAG
104+ ARGS+=( -t "$IMAGE:$USER_TAG" )
119105 fi
106+ # Create new tags pointing to the same digest/manifest
107+ docker buildx imagetools create "${ARGS[@]}" "$IMAGE:$SHA_TAG"
108+
109+ echo "Retagged $IMAGE:$SHA_TAG as: $IMAGE:$DATE_TAG, $IMAGE:latest${USER_TAG:+, $IMAGE:$USER_TAG}"
120110
121111 - name : Summary
122112 run : |
0 commit comments