2017-04-18 02:14:23 +01:00
|
|
|
#!/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
|
|
|
|
|
2018-10-27 23:04:34 +01:00
|
|
|
pip3 install --user mkdocs mkdocs-material pymdown-extensions
|
|
|
|
pip3 install --user git+git://github.com/aleray/mdx_del_ins.git
|
2016-08-19 14:37:44 +01:00
|
|
|
|
|
|
|
mkdir -p out
|
|
|
|
cd out
|
|
|
|
|
|
|
|
git init
|
|
|
|
git remote add origin $FULL_REPO
|
|
|
|
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
|
|
|
|
if [ "$build_result" == "0" -a "$TRAVIS_PULL_REQUEST" == "false" -a "$TRAVIS_BRANCH" == "master" ]; then
|
2018-10-27 23:04:34 +01:00
|
|
|
cd out/
|
|
|
|
mkdocs gh-deploy --config-file ../mkdocs.yml --remote-branch master
|
|
|
|
# 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
|