Created
May 5, 2012 12:57
-
-
Save bbinet/2602153 to your computer and use it in GitHub Desktop.
pull_and_ghpimport.sh script
This file contains 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
#!/bin/bash | |
directory=$1 | |
build_cmd=$2 | |
if [ -z "$directory" ]; then | |
echo "This script takes a directory path as first parameter." | |
exit 1 | |
fi | |
if [ -z "$build_cmd" ]; then | |
echo "This script takes a build command as second parameter." | |
exit 1 | |
fi | |
oldhash=$(git rev-parse HEAD) | |
git pull origin master | |
git submodule sync | |
git submodule update --init | |
newhash=$(git rev-parse HEAD) | |
if [ "$oldhash" == "$newhash" ]; then | |
echo "Nothing to do." | |
else | |
echo "Update gh-pages branch and push to github." | |
if [ -f ./buildout/bin/buildout ]; then | |
./buildout/bin/buildout | |
fi | |
$build_cmd | |
ghp-import -m "update doc to $newhash" $directory | |
git push origin gh-pages --force | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment