Skip to content
Merged
22 changes: 21 additions & 1 deletion .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,27 @@ jobs:
id: get_latest_tag
run: |
git fetch --tags
latest_tag=$(git tag -l | sort -V | tail -n 1)

# 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"

# Strip pre-release suffix (handles -rc1, -rc.1, -alpha.2, etc.)
base_version=$(echo "$most_recent_tag" | sed -E 's/-(rc|alpha|beta)\.?[0-9]+$//')
echo "base version: $base_version"

# Prefer a stable release of this base version if it exists
stable_tag=$(git tag -l | grep "^$base_version$" | head -n 1)
echo "stable tag found: '$stable_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

Expand Down