diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1934e2..50d45b6 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