Created
July 30, 2013 03:00
-
-
Save tbjers/6109844 to your computer and use it in GitHub Desktop.
Script for use with Travis CI to build and deploy a Jekyll site to Github Pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: ruby | |
rvm: | |
- 1.9.3 | |
script: rake generate | |
after_success: bash post_build.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
start=$(date +%s) | |
echo -e "Current repo: $TRAVIS_REPO_SLUG\n" | |
function error_exit | |
{ | |
echo -e "\e[01;31m$1\e[00m" 1>&2 | |
exit 1 | |
} | |
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_REPO_SLUG" == "Xorcode/xorcode.com" ] && [ "$TRAVIS_BRANCH" == "master" ]; then | |
#Set git user | |
git config --global user.email "[email protected]" | |
git config --global user.name "Travis" | |
echo -e "Setting up Github Pages configuration for Octopress" | |
rake setup_github_pages[https://${GH_TOKEN}@github.com/Xorcode/xorcode.github.io] 2> /dev/null || error_exit "Error setting up Octopress for Github Pages"; | |
echo -e "Generating site and deploying to Github Pages" | |
rake generate 2> /dev/null || error_exit "Error generating site"; | |
rake deploy 2> /dev/null || error_exit "Error deploying site to Github Pages"; | |
fi | |
end=$(date +%s) | |
elapsed=$(( $end - $start )) | |
minutes=$(( $elapsed / 60 )) | |
seconds=$(( $elapsed % 60 )) | |
echo "Post-Build process finished in $minutes minute(s) and $seconds seconds" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment