Skip to content

Commit 74707c5

Browse files
authoredSep 1, 2022
chore: Automate website release changes (#2431)
Script some of the manual changes done during release process for website deployment
1 parent 5492dbc commit 74707c5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
 

‎hack/release.sh

+31
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,39 @@ website() {
2323
find website/content/en/${RELEASE_VERSION}/*/*/*.yaml -type f | xargs perl -i -p -e "s/preview/${RELEASE_VERSION}/g;"
2424
}
2525

26+
editWebsiteConfig() {
27+
sed -i '' '/^\/docs\/\*/d' website/static/_redirects
28+
echo "/docs/* /${RELEASE_VERSION}/:splat" >>website/static/_redirects
29+
30+
yq -i ".params.latest_release_version = \"${RELEASE_VERSION}\"" website/config.yaml
31+
yq -i ".menu.main[] |=select(.name == \"Docs\") .url = \"${RELEASE_VERSION}\"" website/config.yaml
32+
33+
editWebsiteVersionsMenu
34+
}
35+
36+
# editWebsiteVersionsMenu sets relevant releases in the version dropdown menu of the website
37+
# without increasing the size of the set.
38+
# TODO: We need to maintain a list of latest minors here only. This is not currently
39+
# easy to achieve, however when we have a major release and we decide to maintain
40+
# a selected minor releases we can maintain that list in the repo and use it in here
41+
editWebsiteVersionsMenu() {
42+
VERSIONS=(${RELEASE_VERSION})
43+
while IFS= read -r LINE; do
44+
SANITIZED_VERSION=$(echo "${LINE}" | sed -e 's/["-]//g' -e 's/ *//g')
45+
VERSIONS+=("${SANITIZED_VERSION}")
46+
done < <(yq '.params.versions' website/config.yaml)
47+
unset VERSIONS[${#VERSIONS[@]}-2]
48+
49+
yq -i '.params.versions = []' website/config.yaml
50+
51+
for VERSION in "${VERSIONS[@]}"; do
52+
yq -i ".params.versions += \"${VERSION}\"" website/config.yaml
53+
done
54+
}
55+
2656
authenticate
2757
buildImages $RELEASE_VERSION
2858
cosignImages
2959
chart
3060
website
61+
editWebsiteConfig

0 commit comments

Comments
 (0)
Please sign in to comment.