From b9e9bf92573918167c4605a3dc24dec281010854 Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Thu, 8 Feb 2024 09:22:28 +1300 Subject: [PATCH] chore: tag image on branch to not publish to stable --- .github/workflows/build.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1934e2..5898cc4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,8 +22,10 @@ jobs: # Generate a timestamp for creating an image version history TIMESTAMP="$(date +%Y%m%d)" COREOS_VERSION="stable" + BRANCH="${GITHUB_REF#refs/heads/}" COMMIT_TAGS=() + BRANCH_TAGS=() BUILD_TAGS=() # Have tags for tracking builds during pull request @@ -31,6 +33,8 @@ jobs: COMMIT_TAGS+=("pr-${{ github.event.number }}-${COREOS_VERSION}") COMMIT_TAGS+=("${SHA_SHORT}-${COREOS_VERSION}") + BRANCH_TAGS+=("${COREOS_VERSION}-${BRANCH}") + BUILD_TAGS=("${COREOS_VERSION}" "${COREOS_VERSION}-${TIMESTAMP}") if [[ "${{ github.event_name }}" == "pull_request" ]]; then @@ -40,6 +44,15 @@ jobs: done alias_tags=("${COMMIT_TAGS[@]}") + + elif [[ "${BRANCH}" != "main" ]]; then + echo "Generated the following branch tags: " + for TAG in "${BRANCH_TAGS[@]}"; do + echo "${TAG}" + done + + alias_tags=("${BRANCH_TAGS[@]") + else alias_tags=("${BUILD_TAGS[@]}") fi