Skip to content

Commit ebe65d8

Browse files
committed
fix: release workflow to tag images correctly
Signed-off-by: Enrique Lacal <[email protected]>
1 parent 85f10f9 commit ebe65d8

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

.github/workflows/docker_release.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,30 @@ jobs:
2121
- name: Get the latest tag
2222
id: get_latest_tag
2323
run: |
24-
git fetch --tags
25-
latest_tag=$(git tag -l | sort -V | tail -n 1)
24+
git fetch --tags
25+
26+
# Get the most recent tag (including RC candidates) to determine the latest version
27+
most_recent_tag=$(git tag -l | sort -V | tail -n 1)
28+
echo "most recent tag: $most_recent_tag"
29+
30+
# Extract the base version (remove rc/alpha/beta suffixes)
31+
base_version=$(echo "$most_recent_tag" | sed -E 's/-?(rc|alpha|beta)[0-9]*$//')
32+
echo "base version: $base_version"
33+
34+
# Look for a stable release of this base version
35+
echo "Looking for exact match of: '$base_version'"
36+
stable_tag=$(git tag -l | grep "^$base_version$" | head -n 1)
37+
echo "stable tag found: '$stable_tag'"
38+
39+
# If we found a stable version, use it; otherwise use the most recent tag
40+
if [ -n "$stable_tag" ]; then
41+
latest_tag="$stable_tag"
42+
echo "found stable version: $stable_tag"
43+
else
44+
latest_tag="$most_recent_tag"
45+
echo "using most recent tag: $most_recent_tag"
46+
fi
47+
2648
echo "latest tag: $latest_tag"
2749
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV
2850

0 commit comments

Comments
 (0)