From a1e24135806294d562aa4837e3d0a49ce4805142 Mon Sep 17 00:00:00 2001 From: EinoHR <60004820+EinoHR@users.noreply.github.com> Date: Sun, 27 Aug 2023 14:28:26 +0300 Subject: [PATCH] fix: dont add malformed tags if $MAJOR_VERSION is empty --- .github/workflows/build.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43434f0b74..2af13b34da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,10 +81,14 @@ jobs: BUILD_TAGS=() # Have tags for tracking builds during pull request SHA_SHORT="${GITHUB_SHA::7}" - COMMIT_TAGS+=("pr-${{ github.event.number }}-${MAJOR_VERSION}") - COMMIT_TAGS+=("${SHA_SHORT}-${MAJOR_VERSION}") - BUILD_TAGS=("${MAJOR_VERSION}" "${MAJOR_VERSION}-${TIMESTAMP}") + # Using clever bash string templating, https://stackoverflow.com/q/40771781 + # don't make malformed tags if $MAJOR_VERSION is empty (base-image didn't include proper labels) -- + COMMIT_TAGS+=("pr-${{ github.event.number }}${MAJOR_VERSION:+-$MAJOR_VERSION}") + COMMIT_TAGS+=("${SHA_SHORT}${MAJOR_VERSION:+-$MAJOR_VERSION}") + + BUILD_TAGS=("${MAJOR_VERSION}" "${MAJOR_VERSION:+$MAJOR_VERSION-}${TIMESTAMP}") + # -- BUILD_TAGS+=("${TIMESTAMP}") BUILD_TAGS+=("latest")