Skip to content

Commit

Permalink
moved travis stuff to .travis/
Browse files Browse the repository at this point in the history
  • Loading branch information
mmariani committed Jan 24, 2017
1 parent 9ad6482 commit 906be1d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: python

install: pip install mkdocs

script: sed 's/docs\///g' README.md > docs/index.md && mkdocs build && bash bin/publish-docs.sh
script: sed 's/docs\///g' README.md > docs/index.md && mkdocs build && bash .travis/publish-docs.sh

notifications:
email: false
Expand Down
File renamed without changes.
22 changes: 17 additions & 5 deletions bin/publish-docs.sh → .travis/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,31 @@ ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K "$ENCRYPTED_KEY" -iv "$ENCRYPTED_IV" -in deploy_key.enc -out deploy_key -d
openssl aes-256-cbc -K "$ENCRYPTED_KEY" -iv "$ENCRYPTED_IV" -in .travis/deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval "$(ssh-agent -s)"
ssh-add deploy_key


# Push build to repository
ssh-add -l
git config --global user.email "Travis Docs CI"
git config --global user.name "Travis Docs CI"
git clone "$GIT_PUB_REPO" "$GIT_PUB_LOCAL_DIR" -b "${GIT_PUB_BRANCH}"
cp -r "${GIT_PUB_BUILD_DIR}" "${GIT_PUB_LOCAL_DIR}${GIT_PUB_SUB_DIR}"
git clone "$GIT_PUB_REPO" "$GIT_PUB_LOCAL_DIR" -b "$GIT_PUB_BRANCH"

# remove old version
cd "$GIT_PUB_LOCAL_DIR"
git add .
git rm -r "$GIT_PUB_SUB_DIR"
cd ..

# add new version
mv "$GIT_PUB_BUILD_DIR" "${GIT_PUB_LOCAL_DIR:?}/${GIT_PUB_SUB_DIR:?}"

# publish
cd "$GIT_PUB_LOCAL_DIR"
git add "$GIT_PUB_SUB_DIR"

# nothing to commit?
git diff --staged --quiet && exit 0

git commit -m "Updating docs."
git push "$GIT_PUB_REPO" "$GIT_PUB_BRANCH"

0 comments on commit 906be1d

Please sign in to comment.