Skip to content

Commit 7c8f9d9

Browse files
committed
fix(docs): fix version discovery to match three-part branch names
The release branches use three-part versions (e.g. rel/1.60.0) but discover-versions.sh filtered with a two-part regex (major.minor), matching zero branches. Updated the regex to match three-part versions and strip the patch to get the section name (1.60), aligning with the original generate.sh behavior and docs/config/production/params.toml. jira: trivial risk: nonprod
1 parent 822fbbc commit 7c8f9d9

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

scripts/discover-versions.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,22 @@ num_versions=${2:-4}
1010

1111
git fetch "$remote_name" 2>/dev/null
1212

13-
# Build a map of section -> branch, keeping only the latest minor per section.
14-
# Associative arrays preserve last-write-wins semantics, matching the original
15-
# generate.sh behavior where later branches overwrite earlier ones.
13+
# Build a map of section -> branch, keeping only the latest patch per section.
14+
# Branches are three-part versions (e.g. rel/1.60.0). We strip the patch to get
15+
# the section (e.g. 1.60), matching the original generate.sh behavior where
16+
# ${target_section%.*} strips the patch component.
1617
declare -A section_map
1718
declare -a section_order
1819

1920
while IFS= read -r vers; do
21+
# Strip patch: 1.60.0 -> 1.60
2022
section="${vers%.*}"
2123
if [ -z "${section_map[$section]+x}" ]; then
2224
section_order+=("$section")
2325
fi
24-
# Later (higher minor) versions overwrite earlier ones for the same major
26+
# Later (higher patch) versions overwrite earlier ones for the same major.minor
2527
section_map["$section"]="rel/$vers"
26-
done < <(git branch -rl "$remote_name/rel/*" | sed 's|.*/rel/||' | grep -E '^[0-9]+\.[0-9]+$' | sort -t. -k1,1n -k2,2n | tail -n"$num_versions")
28+
done < <(git branch -rl "$remote_name/rel/*" | sed 's|.*/rel/||' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n"$num_versions")
2729

2830
# Add dev branch if it exists
2931
if git branch -rl "$remote_name/rel/dev" | grep -q "rel/dev"; then

0 commit comments

Comments
 (0)