From d28e9fcc9212fe3ab6760d51f08ec1d7cc462b59 Mon Sep 17 00:00:00 2001 From: Chris Andreae Date: Sat, 9 Dec 2023 13:18:30 +0900 Subject: [PATCH] deploy: correctly name the branch for both PR and tag builds --- .github/workflows/build-container.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index d032225c82bc..f380028dc143 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -38,9 +38,11 @@ jobs: shell: bash run: | if [ "$GITHUB_HEAD_REF" ]; then + branch_ref="$GITHUB_HEAD_REF" type="pr" tag="pr${PR_NUMBER}.${GITHUB_HEAD_REF}" elif [[ "$GITHUB_REF" == refs/tags/* ]]; then + branch_ref="$GITHUB_REF" type="tag" tag="${GITHUB_REF#refs/tags/}" else @@ -49,6 +51,7 @@ jobs: fi # Replace / with . in container tag names tag="${tag//\//.}" + echo "VERSION_BRANCH="${branch_ref}" >> $GITHUB_ENV echo "VERSION_TYPE=${type}" >> $GITHUB_ENV echo "VERSION_NAME=${tag}" >> $GITHUB_ENV id: extract_name @@ -93,7 +96,7 @@ jobs: --arg version_name "$VERSION_NAME" \ --arg revision "$REVISION_TAG" \ --arg release_time "$timestamp" \ - --arg branch "$GITHUB_REF" \ + --arg branch "$VERSION_BRANCH" \ --arg digest "$digest" \ --arg api_version "$api_version" \ > "/tmp/$VERSION_NAME.json"