Skip to content

Commit

Permalink
Show only the latest major versions in docs
Browse files Browse the repository at this point in the history
When showing the docs switch menu it will show all the versions, and
there is a lot of them, since we don't need to show every minor version
there we do some shell magic to only keep the latest major versions in
the docs.

Here is what alltag variable was before

% for i in $(git tag -l|grep '^v'|sort -rn);do echo -n "$i,";done|sed 's/,$//'
v0.22.4,v0.22.3,v0.22.2,v0.22.1,v0.22.0,v0.21.5,v0.21.4,v0.21.3,v0.21.2,v0.21.1
,v0.21.0,v0.20.0,v0.19.6,v0.19.5,v0.19.4,v0.19.3,v0.19.2,v0.19.1,v0.19.0,
v0.18.0,v0.17.7,v0.17.6,v0.17.5,v0.17.4,v0.17.3,v0.17.2,v0.17.1,v0.17.0,
v0.16.0,v0.15.6,v0.15.5,v0.15.4,v0.15.3,v0.15.2,v0.15.1,v0.15.0,v0.14.3,
v0.14.2,v0.14.1,v0.14.0,v0.13.1,v0.13.0,v0.12.0,v0.11.1,v0.11.0%

and with this changes:

% bash /tmp/a.sh
v0.22.4,v0.21.5,v0.20.0,v0.19.6,v0.18.0,v0.17.7,v0.16.0,v0.15.6,v0.14.3,
v0.13.1,v0.12.0,v0.11.1

Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel authored and piyush-garg committed Dec 22, 2023
1 parent b14dd80 commit 53afff6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .tekton/release-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,23 @@ spec:
exit
}
stable_tag=${version%.*}.x
alltags=$(for i in $(git tag -l|grep '^v'|sort -rn);do echo -n "$i,";done|sed 's/,$//')
# Keep all the latest major versions
# i.e: i have v0.5.1, v0.5.2, v0.6.1, v0.6.2, v0.7.1, v0.7.2
# it will keep v0.5.2, v0.6.2, v0.7.2
declare -A hashmap=()
for i in $(git tag -l | grep '^v' | sort -V); do
version=${i//v/}
if [[ ${version} =~ ^([0-9]+\.[0-9]+)\.[0-9]+$ ]]; then
major_version=${BASH_REMATCH[1]}
fi
hashmap["$major_version"]=$version
done
output=$(for i in "${!hashmap[@]}"; do
echo v"${hashmap[$i]}"
done | sort -rV | tr "\n" ", ")
alltags=${output%,}
allversions="nightly,stable,$alltags"
git config --global user.email "[email protected]"
git config --global user.name "Pipelines as Code CI Robot"
Expand Down

0 comments on commit 53afff6

Please sign in to comment.