librenms/scripts/deploy-docs.sh
Neil Lathwood 0726d479ce
Revert how we deploy docs (#9394)
DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [ ] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`.  If there are schema changes, you can ask on discord how to revert.
2018-10-27 23:16:41 +01:00

37 lines
902 B
Bash

#!/usr/bin/env bash
GH_REPO="@github.com/librenms-docs/librenms-docs.github.io.git"
FULL_REPO="https://${GH_TOKEN}$GH_REPO"
if [ "$EXECUTE_BUILD_DOCS" != "true" ]; then
echo "Doc build skipped"
exit 0
fi
pip3 install --user mkdocs mkdocs-material pymdown-extensions
pip3 install --user 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 ../
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