From 740cbef5c12666625d90f22353a1114c7f43126e Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Fri, 10 Jul 2026 18:14:43 -0300 Subject: [PATCH] feat: add composite action to build and push multi-arch images via remote Docker builder --- build-and-push/action.yaml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/build-and-push/action.yaml b/build-and-push/action.yaml index b73b544..8cdd83d 100644 --- a/build-and-push/action.yaml +++ b/build-and-push/action.yaml @@ -81,6 +81,26 @@ runs: docker context use remote-builder docker buildx inspect --bootstrap + - name: Generate tags list + id: gentags + shell: bash + env: + IMAGE: ${{ inputs.image }} + IMAGE_TAGS: ${{ inputs.image_tag }} + run: | + TAGS_LIST="" + IFS=',' read -ra ADDR <<< "${IMAGE_TAGS}" + for tag in "${ADDR[@]}"; do + trimmed_tag=$(echo "${tag}" | xargs) + if [ -n "${trimmed_tag}" ]; then + TAGS_LIST="${TAGS_LIST}${IMAGE}:${trimmed_tag}"$'\n' + fi + done + + echo "tags<> "$GITHUB_OUTPUT" + echo -n "${TAGS_LIST}" >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" + - name: Build and Push Multi-Arch Image uses: docker/build-push-action@v6 with: @@ -89,5 +109,4 @@ runs: file: ${{ inputs.build_dockerfile }} builder: remote-builder platforms: ${{ inputs.platforms }} - tags: | - ${{ join(fromJSON(format('["{0}:{1}"]', inputs.image, join(split(inputs.image_tag, ','), format('","{0}:', inputs.image)))), '\n') }} + tags: ${{ steps.gentags.outputs.tags }}