Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Configuring travis to upload wikies on gh-pages branch, #51
Browse files Browse the repository at this point in the history
  • Loading branch information
pylover committed Apr 24, 2018
1 parent aee004e commit 71f897a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ install: ./scripts/travis-install.sh
script: coverage run --source wolf $(which nosetests)
after_success:
- coveralls
- if [[ $TRAVIS_BRANCH == 'master' ]]; then ./scripts/travis-upload-wiki.sh ; fi
- if [[ $TRAVIS_BRANCH == 'master' ]] || [[ $TRAVIS_BRANCH == 'nightly' ]]; then ./scripts/travis-upload-wiki.sh ; fi
8 changes: 5 additions & 3 deletions scripts/travis-install.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/usr/bin/env bash

# Use this to encrypt files
# $ tar -cf travis-keys.tar travis-oathcy_rsa*
# $ tar -cf travis-keys.tar travis-oathcy_rsa* travis-wolf_rsa*
# $ travis encrypt-file travis-keys.tar
# $ rm travis-oathcy_rsa*
# $ rm travis-keys.tar
# $ mv travis-oathcy_rsa* travis-wolf_rsa* travis-keys.tar ~/Dropbox/carrene-private/github-keys


openssl aes-256-cbc -K $encrypted_5a97bbf310b0_key -iv $encrypted_5a97bbf310b0_iv \
-in travis-keys.tar.enc -out travis-keys.tar -d
tar -xf travis-keys.tar
chmod 600 travis-oathcy_rsa
chmod 600 travis-wolf_rsa
eval `ssh-agent -s`
ssh-add travis-oathcy_rsa
ssh-add travis-wolf_rsa

pip3 install -U pip setuptools wheel cython
pip3 install -U coverage coveralls
Expand Down
38 changes: 15 additions & 23 deletions scripts/travis-upload-wiki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,21 @@ set -e # Exit with nonzero exit code if anything fails
# Save some useful information
REPO_URL=`git config remote.origin.url`
SHA=`git rev-parse --verify HEAD`

# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
OUT_KEY="travis-github-wiki-rsa"
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in "${OUT_KEY}.enc" -out "$OUT_KEY" -d
chmod 600 $OUT_KEY
eval `ssh-agent -s`
ssh-add $OUT_KEY


# Clone/checkout the wiki branch from Github alongside the master branch working copy directory :
rm -rf ../project-wiki
git -C .. clone [email protected]:Carrene/wolf.wiki.git project-wiki
GIT="git -C ../project-wiki"
$GIT pull origin master
$GIT rm \*.md
cp data/api-documents/api/*.md ../project-wiki/
$GIT add \*.md
VERSION=`grep -P '^__version__ =' wolf/__init__.py | grep -oP \
'([1-9]\d*!)?(0|[1-9]\d*)(\.(0|[1-9]\d*))*((a|b|rc)(0|[1-9]\d*))?(\.post(0|[1-9]\d*))?(\.dev(0|[1-9]\d*))?'`
VERSION="v${VERSION}"
TARGET="../project-gh-pages/$VERSION"
# Clone/checkout the gh-pages branch from Github alongside the master branch working copy
# directory:
rm -rf ../project-gh-pages
git -C .. clone [email protected]:Carrene/wolf.git -b gh-pages project-gh-pages
GIT="git -C ../project-gh-pages"
$GIT rm $VERSION/\*.md
mkdir -p $TARGET
cp data/documentation/*.md $TARGET
$GIT add $VERSION/\*.md
$GIT config user.name "Travis CI"
$GIT config user.email "$COMMIT_AUTHOR_EMAIL"
$GIT commit -am "Deploy to GitHub WIKI: ${SHA}"
$GIT push origin master
$GIT commit -am "Deploy to Github Pages: ${VERSION} ${SHA}"
$GIT push origin gh-pages

Binary file modified travis-keys.tar.enc
Binary file not shown.

0 comments on commit 71f897a

Please sign in to comment.