Files
librenms-librenms/scripts/deploy-docs.sh
T

54 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2016-08-19 16:43:53 +01:00
GH_REPO="@github.com/librenms-docs/librenms-docs.github.io.git"
2016-08-19 14:37:44 +01:00
FULL_REPO="https://${GH_TOKEN}$GH_REPO"
2018-01-02 08:20:19 -06:00
if [ "$EXECUTE_BUILD_DOCS" != "true" ]; then
echo "Doc build skipped"
exit 0
fi
2019-07-25 08:10:47 -05:00
pip3 install --upgrade pip
2020-02-25 14:42:16 +01:00
pip3 install --user --requirement <(cat <<EOF
future==0.18.2
2020-06-02 22:51:54 -05:00
Jinja2==2.11.2
2020-02-25 14:42:16 +01:00
livereload==2.6.1
lunr==0.5.8
Markdown==3.2.2
mkdocs==1.1.2
2020-10-06 01:52:16 +02:00
mkdocs-exclude==1.0.2
mkdocs-material==5.2.2
nltk==3.5
pymdown-extensions==7.1
2020-06-02 22:51:54 -05:00
PyYAML==5.3.1
six==1.15.0
tornado==6.0.4
2020-06-02 22:55:52 -05:00
MarkupSafe==1.1.1
2020-02-25 14:42:16 +01:00
EOF
)
2016-08-19 14:37:44 +01:00
mkdir -p out
cd out
git init
2020-02-25 14:42:16 +01:00
git remote add origin "$FULL_REPO"
2016-08-19 14:37:44 +01:00
git fetch
2016-08-19 15:26:37 +01:00
git config user.name "librenms-docs"
2016-08-19 14:37:44 +01:00
git config user.email "travis@librenms.org"
2016-08-19 16:54:30 +01:00
git checkout master
2016-08-19 14:37:44 +01:00
cd ../
mkdocs build --clean
2018-01-02 08:20:19 -06:00
build_result=$?
# Only deploy after merging to master
2020-02-25 14:42:16 +01:00
if [ "$build_result" == "0" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
cd out/
2018-10-27 23:16:41 +01:00
touch .
git add -A .
git commit -m "GH-Pages update by travis after $TRAVIS_COMMIT"
git push -q origin master
2018-01-02 08:20:19 -06:00
else
exit ${build_result} # return doc build result
fi