File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,8 +156,22 @@ jobs:
156156 # Extract the date (e.g., release/2026-01-11 -> 2026-01-11)
157157 VERSION_NAME=${GITHUB_REF#refs/heads/release/}
158158
159- # Deploy this version, tag it as 'latest', and set it as the default site root
160- uv run mike deploy --push --update-aliases $VERSION_NAME latest
159+ # Fetch all release branches to determine if this is the latest
160+ git fetch origin "+refs/heads/release/*:refs/remotes/origin/release/*"
161+
162+ # Find the highest version number among all release branches
163+ LATEST_VERSION=$(git branch -r --list "origin/release/*" | sed 's|origin/release/||' | sort -V | tail -n 1 | tr -d ' ')
164+
165+ echo "Deploying version: $VERSION_NAME"
166+ echo "Latest detected version: $LATEST_VERSION"
167+
168+ if [ "$VERSION_NAME" = "$LATEST_VERSION" ]; then
169+ echo "This is the latest version. Updating 'latest' alias."
170+ uv run mike deploy --push --update-aliases "$VERSION_NAME" latest
171+ else
172+ echo "This is NOT the latest version. Deploying without updating 'latest' alias."
173+ uv run mike deploy --push "$VERSION_NAME"
174+ fi
161175
162176 - name : Create GitHub Release and Tag
163177 if : startsWith(github.ref, 'refs/heads/release/')
You can’t perform that action at this time.
0 commit comments