[Emacs] Only attempt an update if the build is based on master

This commit is contained in:
Ivan Malison 2016-12-29 17:09:23 -08:00
parent dbe968312a
commit f31b125868
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -5,8 +5,8 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $THIS_DIR
git config user.name "$COMMIT_AUTHOR_NAME"
git config user.email "$COMMIT_AUTHOR_EMAIL"
git config --global user.name "$COMMIT_AUTHOR_NAME"
git config --global user.email "$COMMIT_AUTHOR_EMAIL"
set -e # Exit with nonzero exit code if anything fails
@ -59,4 +59,11 @@ mv ../README.html ./index.html
git add --all .
git commit -m "Deploy to GitHub Pages: ${SHA}"
git push "$SSH_REPO" "$TARGET_BRANCH"
git fetch origin master
if [ "$(git rev-parse origin/master)" == "$SHA" ]; then
git push "$SSH_REPO" "$TARGET_BRANCH"
else
echo "The commit this build was started for is not the one on master. Doing nothing."
fi