The stable book should build from branch

This commit is contained in:
Henrik Tjäder 2020-10-05 07:50:30 +00:00
parent 35baf20c61
commit 3021048b77

View file

@ -594,27 +594,30 @@ jobs:
- name: Build books - name: Build books
run: | run: |
langs=( en ru ) langs=( en ru )
latest=0.5 devver=dev
vers=( 0.4.x ) stable=$(git tag | grep v | tail -n 1 | cut -c2-4)
vers=( 0.5.x 0.4.x )
# Create directories # Create directories
td=$(mktemp -d) td=$(mktemp -d)
mkdir -p $td/$latest/book/ mkdir -p $td/$devver/book/
cp -r target/doc $td/$latest/api cp -r target/doc $td/$devver/api
# sed fixes # Redirect the main site to the stable release
sed 's|URL|rtic/index.html|g' redirect.html > $td/$latest/api/index.html sed "s|URL|$stable|g" redirect.html > $td/index.html
sed 's|URL|0.5|g' redirect.html > $td/index.html
sed 's|URL|book/en|g' redirect.html > $td/$latest/index.html # Create the redirects for dev-version
sed 's|URL|rtic/index.html|g' redirect.html > $td/$devver/api/index.html
sed 's|URL|book/en|g' redirect.html > $td/$devver/index.html
# Build books # Build books
for lang in ${langs[@]}; do for lang in ${langs[@]}; do
( cd book/$lang && mdbook build ) ( cd book/$lang && mdbook build )
cp -r book/$lang/book $td/$latest/book/$lang cp -r book/$lang/book $td/$devver/book/$lang
cp LICENSE-* $td/$latest/book/$lang/ cp LICENSE-* $td/$devver/book/$lang/
done done
# Build older versions # Build older versions, including stable
root=$(pwd) root=$(pwd)
for ver in ${vers[@]}; do for ver in ${vers[@]}; do
prefix=${ver%.*} prefix=${ver%.*}
@ -639,6 +642,9 @@ jobs:
rm -rf $src rm -rf $src
done done
# Create alias for the stable release
ln -s $td/$stable $td/stable
# Forward CNAME file # Forward CNAME file
cp CNAME $td/ cp CNAME $td/
mv $td/ bookstodeploy mv $td/ bookstodeploy