From 3393e4af072929be3cc32e28267f42bcba3e44c6 Mon Sep 17 00:00:00 2001 From: Johannes Ziemke Date: Wed, 4 Oct 2023 12:15:21 +0200 Subject: [PATCH] Fix setting base tag on branches --- .github/workflows/build-push-agents-images.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-push-agents-images.yaml b/.github/workflows/build-push-agents-images.yaml index 93799ba..5f3099d 100644 --- a/.github/workflows/build-push-agents-images.yaml +++ b/.github/workflows/build-push-agents-images.yaml @@ -87,13 +87,18 @@ jobs: - name: Find base tag id: base-tag run: | - semver=${{ steps.meta.outputs.version }} - major=${semver%%.*} - # If not a semver (e.g branch name), use main as base tag - if [[ $major == "$semver" ]]; then + ref=${{ steps.meta.outputs.version }} + # on release-* branches, use branch as base tag + if [[ $ref == release-* ]]; then + echo "tag=$ref" >> "$GITHUB_OUTPUT" + exit 0 + fi + # on any other branch, use main as base tag + if [[ ! $ref =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then echo "tag=main" >> "$GITHUB_OUTPUT" exit 0 fi + major=${semver%%.*} minor_and_patch=${semver#*.} minor=${minor_and_patch%%.*} echo "tag=v${major}.${minor}" >> "$GITHUB_OUTPUT"