Skip to content
This repository has been archived by the owner on Oct 25, 2018. It is now read-only.

Commit

Permalink
Add travis build and deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Oct 24, 2018
1 parent 134a7aa commit 47975d5
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

[{*.sh,*.yml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Jetbrains
/.idea
/*.iml

# Visual Studio Code
/.vscode

# App
/.dev
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
sudo: required
language: python

env:
global:
- GH_REF=github.com/librenms/docs.git

cache:
directories:
- $HOME/.cache/pip

before_install:
- sudo apt-get update
- |
declare -r SSH_FILE="$(mktemp -u $HOME/.ssh/XXXXX)" \
&& openssl aes-256-cbc -K $encrypted_c76ae67c982d_key -iv $encrypted_c76ae67c982d_iv -in ".travis/deploy_key.enc" -out "$SSH_FILE" -d
&& chmod 600 "$SSH_FILE" \
&& print "\nHost github.com\n IdentityFile $SSH_FILE\n LogLevel ERROR" >> "$HOME/.ssh/config"
install:
- pip install --user 'jinja2<2.9' mkdocs pymdown-extensions
- pip install --user git+git://github.com/aleray/mdx_del_ins.git

script: "./deploy.sh"

branches:
only:
- dev
Binary file added .travis/deploy_key.enc
Binary file not shown.
27 changes: 27 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# do not continue if pull request
if [ $TRAVIS_PULL_REQUEST == "true" ]; then
echo "This is a PR, exiting..."
exit 0
fi

# enable error reporting to the console
set -e

# build
rm -rf out
mkdir -p out
mkdocs build --clean
build_result=$?
if [ "$build_result" == "0" ]; then
cd out
git init
git config user.name "librenms-docs"
git config user.email "travis@librenms.org"
git add .
git commit -a -m "Travis #$TRAVIS_BUILD_NUMBER"
git push --force --quiet "git@${GH_REF}" master:master > /dev/null 2>&1
else
exit ${build_result}
fi

0 comments on commit 47975d5

Please sign in to comment.