Skip to content

Commit

Permalink
Merge pull request googleapis#273 from silvolu/fix-docs-build
Browse files Browse the repository at this point in the history
fix(build): execute git commit only if there have been changes
  • Loading branch information
silvolu committed Oct 31, 2014
2 parents 5209fc0 + a067dab commit 1c2b45a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]
set +e
git add .
set -e
# commit to gh-pages branch to apply changes
git config user.name "selfiebot"
git commit -m "Update docs after merge to master"
git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages
git status
# H/T: https://github.com/dhermes
if [[ -n "$(git status --porcelain)" ]]; then
# commit to gh-pages branch to apply changes
git config user.name "selfiebot"
git commit -m "Update docs after merge to master"
git status
git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages
else
echo "Nothing to commit. Exiting without pushing changes."
fi
fi

0 comments on commit 1c2b45a

Please sign in to comment.