From ebe65d8363b877239f12ba5e10388fc9761f55b0 Mon Sep 17 00:00:00 2001 From: Enrique Lacal Date: Mon, 21 Jul 2025 10:30:40 +0100 Subject: [PATCH] fix: release workflow to tag images correctly Signed-off-by: Enrique Lacal --- .github/workflows/docker_release.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_release.yml b/.github/workflows/docker_release.yml index 9fdabe043f..919173a0db 100644 --- a/.github/workflows/docker_release.yml +++ b/.github/workflows/docker_release.yml @@ -21,8 +21,30 @@ jobs: - name: Get the latest tag id: get_latest_tag run: | - git fetch --tags - latest_tag=$(git tag -l | sort -V | tail -n 1) + git fetch --tags + + # Get the most recent tag (including RC candidates) to determine the latest version + most_recent_tag=$(git tag -l | sort -V | tail -n 1) + echo "most recent tag: $most_recent_tag" + + # Extract the base version (remove rc/alpha/beta suffixes) + base_version=$(echo "$most_recent_tag" | sed -E 's/-?(rc|alpha|beta)[0-9]*$//') + echo "base version: $base_version" + + # Look for a stable release of this base version + echo "Looking for exact match of: '$base_version'" + stable_tag=$(git tag -l | grep "^$base_version$" | head -n 1) + echo "stable tag found: '$stable_tag'" + + # If we found a stable version, use it; otherwise use the most recent tag + if [ -n "$stable_tag" ]; then + latest_tag="$stable_tag" + echo "found stable version: $stable_tag" + else + latest_tag="$most_recent_tag" + echo "using most recent tag: $most_recent_tag" + fi + echo "latest tag: $latest_tag" echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV