mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* remove unneeded semi-colons at end of line * fix SC2206: Quote to prevent word splitting/globbing * fix SC2164: Use 'cd ... || exit' in case cd fails * fix SC2004: $/${} is unnecessary on arithmetic variables. * fix SC2155: Declare and assign separately to avoid masking return values. * fix SC2124: Assigning an array to a string! Assign as array, or use * instead of @ to concatenate. * fix SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo". * fix SC2076: Don't quote rhs of =~, it'll match literally rather than as a regex. * fix SC1090: Can't follow non-constant source. Use a directive to specify location. * fix SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. * SC2223: This default assignment may cause DoS due to globbing. Quote it. * fix SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. * fix SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n" * better handling of branch comapre * add missing local ver_73 from merge * remove duplicate definition
63 lines
1.3 KiB
Bash
Executable File
63 lines
1.3 KiB
Bash
Executable File
#!/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 --upgrade pip
|
|
pip3 install --user --requirement <(cat <<EOF
|
|
click==7.1.2
|
|
future==0.18.2
|
|
Jinja2==2.11.2
|
|
joblib==0.17.0
|
|
livereload==2.6.3
|
|
lunr==0.5.8
|
|
Markdown==3.3.2
|
|
MarkupSafe==1.1.1
|
|
mkdocs==1.1.2
|
|
mkdocs-exclude==1.0.2
|
|
mkdocs-macros-plugin==0.4.18
|
|
mkdocs-material==6.1.0
|
|
mkdocs-material-extensions==1.0.1
|
|
nltk==3.5
|
|
Pygments==2.7.1
|
|
pymdown-extensions==8.0.1
|
|
python-dateutil==2.8.1
|
|
PyYAML==5.3.1
|
|
regex==2020.10.23
|
|
six==1.15.0
|
|
termcolor==1.1.0
|
|
tornado==6.0.4
|
|
tqdm==4.50.2
|
|
EOF
|
|
)
|
|
|
|
|
|
mkdir -p out
|
|
cd out || exit 1
|
|
|
|
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 ../ || exit 1
|
|
mkdocs build --clean
|
|
build_result=$?
|
|
|
|
# Only deploy after merging to master
|
|
if [ "$build_result" == "0" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
|
|
cd out/ || exit 1
|
|
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
|