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"
|
2017-10-02 21:36:22 +01:00
|
|
|
THEME_REPO="https://github.com/librenms-docs/theme_v2.git"
|
2016-08-19 14:37:44 +01:00
|
|
|
|
2018-01-02 08:20:19 -06:00
|
|
|
if [ "$EXECUTE_BUILD_DOCS" != "true" ]; then
|
|
|
|
echo "Doc build skipped"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2018-03-14 20:25:19 +00:00
|
|
|
pip install --user 'jinja2<2.9' mkdocs pymdown-extensions
|
|
|
|
pip 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 ../
|
|
|
|
|
2016-08-21 21:10:01 +01:00
|
|
|
git clone $THEME_REPO
|
|
|
|
|
2016-08-19 14:37:44 +01:00
|
|
|
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
|
|
|
|
cd out
|
|
|
|
|
|
|
|
touch .
|
|
|
|
git add -A .
|
|
|
|
git commit -m "GH-Pages update by travis after $TRAVIS_COMMIT"
|
|
|
|
git push -q origin master
|
|
|
|
else
|
|
|
|
exit ${build_result} # return doc build result
|
|
|
|
fi
|