From 2243f0f113e96925d1ca4e1f3c92bb51914c3e4c Mon Sep 17 00:00:00 2001 From: Sven Trieflinger Date: Fri, 28 Jul 2023 08:05:51 +0200 Subject: [PATCH] fix(service): extract the label part from what is returned by the metadata action (#71) Signed-off-by: Sven Trieflinger --- .github/workflows/service.publish.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/service.publish.yaml b/.github/workflows/service.publish.yaml index f969c73f..1d4d6b8f 100644 --- a/.github/workflows/service.publish.yaml +++ b/.github/workflows/service.publish.yaml @@ -68,12 +68,20 @@ jobs: uses: imjasonh/setup-ko@v0.6 - name: Publish Docker Images run: | - # Generate tags flag + # Generate tags flag (Metadata action output is newline delimited entries like + # 'ghcr.io/carbynestack/ephemeral:0.1.10' and we only need the part after the colon) readarray -t tags < <( echo "${{ steps.meta.outputs.tags }}" ) + for i in "${!tags[@]}"; do + readarray -d ":" -t parts < <( echo "${tags[i]}" ) + tags[i]=$(echo "${parts[1]}" | tr -d '\n') + done printf -v joined_tags "%s," "${tags[@]}" + # Generate label flags readarray -t labels < <( echo "${{ steps.meta.outputs.labels }}" ) printf -v label_flags -- "--image-label=%s " "${labels[@]}" + + # Publish using ko ko publish -B \ --tags="${joined_tags%,}" \ "${label_flags}" \