Skip to content

Instantly share code, notes, and snippets.

@bbinet
Created May 5, 2012 12:57
Show Gist options
  • Save bbinet/2602153 to your computer and use it in GitHub Desktop.
Save bbinet/2602153 to your computer and use it in GitHub Desktop.
pull_and_ghpimport.sh script
#!/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