2022-12-11 04:21:56 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-02-09 17:53:47 +08:00
|
|
|
set -eu
|
2023-01-13 04:46:18 +08:00
|
|
|
|
2023-10-03 03:36:26 +08:00
|
|
|
# Build the docs for these tags (the last tag of old major releases)
|
|
|
|
# We build the docs for historical reasons. The branch no longer exists
|
|
|
|
# since the release is no longer supported/maintained.
|
|
|
|
TAGS=(
|
2023-12-05 23:47:22 +08:00
|
|
|
v2.5.19
|
2023-10-03 03:36:26 +08:00
|
|
|
)
|
|
|
|
|
2023-03-09 04:03:43 +08:00
|
|
|
# Build the docs only for these release branches
|
|
|
|
BRANCHES=(
|
|
|
|
v2.6.x-release
|
2023-06-01 22:05:46 +08:00
|
|
|
v2.7.x-release
|
2023-12-08 05:33:38 +08:00
|
|
|
v3.0.x-release
|
2023-03-09 04:03:43 +08:00
|
|
|
)
|
|
|
|
REMOTE="origin"
|
|
|
|
|
2023-02-09 17:53:47 +08:00
|
|
|
git fetch --all
|
2023-10-03 23:20:29 +08:00
|
|
|
git fetch --tags
|
2023-02-09 17:53:47 +08:00
|
|
|
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
|
2023-10-03 03:36:26 +08:00
|
|
|
for tag in "${TAGS[@]}"; do
|
|
|
|
|
2023-10-03 03:45:21 +08:00
|
|
|
if [ "$tag" != "$current_branch" ]; then
|
2023-10-03 03:36:26 +08:00
|
|
|
git fetch "$REMOTE" "$tag"
|
|
|
|
fi
|
|
|
|
|
|
|
|
git checkout "$tag"
|
|
|
|
if [ -f docusaurus.config.js ]; then
|
2023-10-03 03:45:21 +08:00
|
|
|
version=${tag:1:3}-legacy
|
2023-10-03 03:36:26 +08:00
|
|
|
echo "Adding documentation for $version"
|
|
|
|
yarn docusaurus docs:version "${version}"
|
|
|
|
else
|
2023-10-03 03:45:21 +08:00
|
|
|
echo "Warning: branch/tag $(version) does not contain a docusaurus.config.js!"
|
2023-10-03 03:36:26 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
2023-03-09 04:03:43 +08:00
|
|
|
for branch in "${BRANCHES[@]}"; do
|
|
|
|
|
2023-03-07 23:15:22 +08:00
|
|
|
if [ "$branch" != "$current_branch" ]; then
|
2023-03-09 04:03:43 +08:00
|
|
|
git fetch "$REMOTE" "$branch":"$branch"
|
2023-03-07 23:15:22 +08:00
|
|
|
fi
|
2022-12-11 04:21:56 +08:00
|
|
|
|
2023-03-09 04:03:43 +08:00
|
|
|
git checkout "$branch"
|
2022-12-11 04:21:56 +08:00
|
|
|
if [ -f docusaurus.config.js ]; then
|
2023-03-09 04:03:43 +08:00
|
|
|
version=${branch:1:3}
|
2022-12-11 04:21:56 +08:00
|
|
|
echo "Adding documentation for $version"
|
2023-01-13 04:46:18 +08:00
|
|
|
yarn docusaurus docs:version "${version}"
|
2023-03-09 04:03:43 +08:00
|
|
|
else
|
|
|
|
echo "Warning: branch $(branch) does not contain a docusaurus.config.js!"
|
2022-12-11 04:21:56 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
2023-02-09 17:53:47 +08:00
|
|
|
git checkout "$current_branch"
|