Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,25 @@ jobs:

- name: Create multi-arch manifest
working-directory: /tmp/digests
env:
TAGS: ${{ steps.meta.outputs.tags }}
run: |
# Word splitting is deliberate here: the first substitution expands
# to "-t tag -t tag ...", the second to one ref per digest file.
# shellcheck disable=SC2046
docker buildx imagetools create \
$(jq -cr '.target."docker-metadata-action".tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
# Read the newline-separated tags output directly rather than
# jq-ing DOCKER_METADATA_OUTPUT_JSON: that env var's shape is not
# the bake-file layout, and a wrong path yields zero tags, which
# imagetools rejects ("can't push with no tags specified").
args=()
while read -r tag; do
[ -n "$tag" ] && args+=(-t "$tag")
done <<< "$TAGS"
if [ ${#args[@]} -eq 0 ]; then
echo "::error::docker/metadata-action produced no tags for ${GITHUB_REF}"
exit 1
fi
for digest in *; do
args+=("${IMAGE}@sha256:${digest}")
done
docker buildx imagetools create "${args[@]}"

# The secrets context is not available in `if:` expressions, so
# presence has to be probed in a shell step and passed on as an output.
Expand Down
Loading