2017-03-24 04:00:33 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-03-24 04:44:25 +00:00
|
|
|
# IMPORTANT! To add a new version, say 8.1
|
2017-08-06 19:54:41 +00:00
|
|
|
# * copy 2.3.yaml to 8.1.yaml
|
2017-03-24 04:44:25 +00:00
|
|
|
# * edit 8.1.yaml
|
2018-12-07 22:10:47 +00:00
|
|
|
# * edit theme/scripts.html and update docVersions variable
|
2017-08-18 00:03:53 +00:00
|
|
|
|
2020-10-07 17:00:02 +00:00
|
|
|
cd "$(dirname $0)" || exit
|
2017-10-05 21:07:33 +00:00
|
|
|
rm -f latest.yaml
|
2017-08-18 00:03:53 +00:00
|
|
|
|
2019-02-13 00:27:11 +00:00
|
|
|
# find all *.yaml files and convert them to array, pick the latest
|
2020-09-28 23:04:42 +00:00
|
|
|
cfiles=$(find . -maxdepth 1 -name '*.yaml' | sort)
|
2020-10-02 22:02:06 +00:00
|
|
|
mapfile -t cfiles_array <<< "$cfiles"
|
2020-09-28 23:04:42 +00:00
|
|
|
latest_cfile=${cfiles_array[-1]} # becomes "3.1.yaml"
|
2019-02-13 00:27:11 +00:00
|
|
|
latest_ver=${latest_cfile%.yaml} # becomes "3.1"
|
|
|
|
|
|
|
|
# build all documentation versions at the same time (4-8x speedup)
|
2020-10-07 17:00:02 +00:00
|
|
|
parallel --will-cite mkdocs build --config-file ::: $cfiles
|
2017-08-18 00:03:53 +00:00
|
|
|
|
|
|
|
# drop the 'latest.yml' symlink to the latest version so `mkdocs serve` will
|
|
|
|
# automatically serve the latest
|
2019-02-13 00:27:11 +00:00
|
|
|
echo "Latest version: $latest_ver"
|
2020-10-07 17:00:02 +00:00
|
|
|
ln -fs $latest_cfile latest.yaml
|
2017-03-24 04:44:25 +00:00
|
|
|
|
|
|
|
# copy the index file which serves /docs requests and redirects
|
|
|
|
# visitors to the latest verion of QuickStart
|
|
|
|
cp index.html ../build/docs/index.html
|
2018-03-12 02:42:38 +00:00
|
|
|
|
2019-02-13 00:27:11 +00:00
|
|
|
# create a symlink called 'latest' to the latest directory, like "3.1"
|
2020-09-28 23:04:42 +00:00
|
|
|
cd ../build/docs || exit
|
2018-03-12 02:42:38 +00:00
|
|
|
rm -f latest
|
2020-10-07 17:00:02 +00:00
|
|
|
ln -s $latest_ver latest
|
2019-02-13 00:27:11 +00:00
|
|
|
|
|
|
|
echo "The docs have been built and saved in 'build/docs'"
|