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 }}