Skip to content

Commit

Permalink
Merge pull request #106 from marcusholl/pr/deployMkDocs
Browse files Browse the repository at this point in the history
Deploy mkdocs when merging to master
  • Loading branch information
marcusholl committed Mar 19, 2018
2 parents 31e4437 + 0a58ad6 commit 77a8f66
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@ install:
- pip install --user mkdocs mkdocs-material
script:
- mvn test -B
- if [[ "${TRAVIS_PULL_REQUEST}" != "false" ]]; then cd documentation && mkdocs build --clean --verbose --strict && cd ..; fi;
- |
if [[ "${TRAVIS_PULL_REQUEST}" != "false" ]]
then
cd documentation && mkdocs build --clean --verbose --strict && cd ..
else
# Only in case we are in master branch of the leading SAP repo we would like to deploy,
# not from the forks.
if [[ "${TRAVIS_BRANCH}" == "master" && "${TRAVIS_REPO_SLUG}" == "SAP/jenkins-library" ]]
then
openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv -in cfg/id_rsa.enc -out cfg/id_rsa -d
./gh-pages-deploy.sh
else
echo "Publishing documentation skipped."
fi
fi
cache:
directories:
- $HOME/.m2
Expand Down
Binary file added cfg/id_rsa.enc
Binary file not shown.
15 changes: 15 additions & 0 deletions gh-pages-deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

echo "Found change on master: Deployment of documentation"

PRIVATE_KEY="cfg/id_rsa"

chmod 600 "${PRIVATE_KEY}"
eval `ssh-agent -s`
ssh-add "${PRIVATE_KEY}"
git config user.name "Travis CI Publisher"
git remote add docu "git@github.com:$TRAVIS_REPO_SLUG.git";
git fetch docu gh-pages:gh-pages
echo "Pushing to gh-pages of repository $TRAVIS_REPO_SLUG"
cd $TRAVIS_BUILD_DIR/documentation
mkdocs gh-deploy -v --clean --remote-name docu

0 comments on commit 77a8f66

Please sign in to comment.