haiku-website/scripts/build_for_deploy.sh

52 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
HUGO=hugo
for cmd in "mv rm wget unzip sed $HUGO"; do
command -v $cmd >/dev/null 2>&1 || { echo -e >&2 "$cmd is not installed, please install it."; exit 1; }
done
echo "Using Hugo $HUGO"
if [ ! -d content ]; then
echo "This script must be run from the root of the repository."
exit 1
fi
if [ ! -d haiku ]; then
git clone https://github.com/haiku/haiku/ --depth=5
fi
cd haiku
if [ ! -d generated ]; then
mkdir generated
cd generated
wget http://doxygen.nl/files/doxygen-1.8.16.linux.bin.tar.gz -O doxygen.tar.gz -nv
tar -xvf doxygen.tar.gz doxygen-1.8.16/bin/
mkdir doxybin
mv doxygen-*/bin/* doxybin/
rm -rf doxygen-*/
rm doxygen.tar.gz
cd ..
fi
gitout=$(git pull --ff-only)
if [[ $gitout != *"Already up-to-date"* ]] || [ ! -d "generated/doxygen/html" ]; then
cd docs/user/
../../generated/doxybin/doxygen
cd ../..
fi
cd ..
rm -rf public/docs/
sed -i "s/BuildTypeIsDeploy = false/BuildTypeIsDeploy = true/g" config.toml
$HUGO --minify
sed -i "s/BuildTypeIsDeploy = true/BuildTypeIsDeploy = false/g" config.toml
mkdir public/docs/
cp -R haiku/docs/userguide/ public/docs/
cp -R haiku/docs/welcome/ public/docs/
cp -R haiku/docs/interface_guidelines/ public/docs/
cp -R haiku/generated/doxygen/html/ public/docs/
mv public/docs/html/ public/docs/api/
mv public/docs/interface_guidelines/ public/docs/HIG/