Skip to content

Commit 654f797

Browse files
committed
fix(docker-build): Generate image and tag list without empty lines
1 parent 2d6d844 commit 654f797

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

docker-build/action.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,35 @@ runs:
5858
fi
5959
echo "Setting IMAGE_TAG=${tag} as output"
6060
echo "IMAGE_TAG=${tag}" >> "$GITHUB_OUTPUT"
61+
62+
- name: Set image list
63+
shell: bash
64+
id: set-images
65+
run: |
66+
images="${{ inputs.gar_location }}-docker.pkg.dev/${{ inputs.project_id }}/${{ inputs.gar_name }}/${{ inputs.image_name }}"
67+
if [[ "${{ inputs.should_tag_ghcr }}" == "true" ]]; then
68+
images="${images}"$'\n'"ghcr.io/${{ github.repository }}/${{ inputs.image_name }}"
69+
fi
70+
echo -e "Generated Images:\n${images}"
71+
echo -e "IMAGES=<<EOF\n${images}\nEOF" >> "$GITHUB_OUTPUT"
72+
73+
- name: Set tag list
74+
shell: bash
75+
id: set-tags
76+
run: |
77+
tags="type=raw,value=${{ steps.mozcloud-tag.outputs.IMAGE_TAG }}"
78+
if [[ "${{ inputs.should_tag_latest }}" == "true" ]]; then
79+
tags="${tags}"$'\n'"type=raw,value=latest"
80+
fi
81+
echo -e "Generated Tags:\n${tags}"
82+
echo -e "TAGS=<<EOF\n${tags}\nEOF" >> "$GITHUB_OUTPUT"
83+
6184
- name: Docker meta
6285
id: meta
6386
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 #v5.7.0
6487
with:
65-
images: |
66-
${{ inputs.gar_location }}-docker.pkg.dev/${{ inputs.project_id }}/${{ inputs.gar_name }}/${{ inputs.image_name }}
67-
${{ (inputs.should_tag_ghcr == 'true' && format('ghcr.io/{0}/{1}', github.repository, inputs.image_name)) || '' }}
68-
tags: |
69-
type=raw,value=${{ steps.mozcloud-tag.outputs.IMAGE_TAG }}
70-
type=raw,value=${{ (inputs.should_tag_latest == 'true' && latest) || ''}}
88+
images: ${{ steps.set-images.outputs.images }}
89+
tags: ${{ steps.set-tags.outputs.tags }}
7190
- name: Build image
7291
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 #v6.18.0
7392
env:

0 commit comments

Comments
 (0)