mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Test docs before deploying fix issue with docs * Actually check the result of the doc build add error for testing * Fix up docs * use original logic * only deploy docs if build succeeds. Make pip quiet
45 lines
1.0 KiB
Bash
45 lines
1.0 KiB
Bash
#!/usr/bin/env bash
|
|
GH_REPO="@github.com/librenms-docs/librenms-docs.github.io.git"
|
|
FULL_REPO="https://${GH_TOKEN}$GH_REPO"
|
|
THEME_REPO="https://github.com/librenms-docs/theme_v2.git"
|
|
|
|
if [ "$EXECUTE_BUILD_DOCS" != "true" ]; then
|
|
echo "Doc build skipped"
|
|
exit 0
|
|
fi
|
|
|
|
pip install --user --quiet 'jinja2<2.9'
|
|
pip install --user --quiet mkdocs
|
|
pip install --user --quiet pymdown-extensions
|
|
pip install --user --quiet git+git://github.com/aleray/mdx_del_ins.git
|
|
|
|
mkdir -p out
|
|
|
|
cd out
|
|
|
|
git init
|
|
git remote add origin $FULL_REPO
|
|
git fetch
|
|
git config user.name "librenms-docs"
|
|
git config user.email "travis@librenms.org"
|
|
git checkout master
|
|
|
|
cd ../
|
|
|
|
git clone $THEME_REPO
|
|
|
|
mkdocs build --clean
|
|
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
|