Skip to content

Commit

Permalink
Avoid build failure if there is nothing new to push
Browse files Browse the repository at this point in the history
  • Loading branch information
silvolu committed Dec 3, 2014
1 parent 3c7df9c commit 6a9668d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
21 changes: 15 additions & 6 deletions scripts/update_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,19 @@ git submodule add -b gh-pages \
ghpages
cp -R docs/_build/html/* ghpages/
cd ghpages
# allow "git add" to fail if there aren't new files.
set +e
git add .
# 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
set -e
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 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
17 changes: 13 additions & 4 deletions scripts/update_wheels_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,18 @@ echo "${TRAVIS_COMMIT}" > ${FRESH_REPO_DIR}/LATEST_COMMIT
# Display git status and push LATEST_COMMIT. #
##############################################
cd ${FRESH_REPO_DIR}
git add LATEST_COMMIT

# allow "git add" to fail if there aren't new files.
# this can happen if we re-run builds on travis.
set +e
git add LATEST_COMMIT
set -e
git status
git commit -m "Main project gcloud-python has been updated."
git status
git push origin master
# H/T: https://github.com/dhermes
if [[ -n "$(git status --porcelain)" ]]; then
git commit -m "Main project gcloud-python has been updated."
git status
git push origin master
else
echo "Nothing to commit. Exiting without pushing changes."
fi

0 comments on commit 6a9668d

Please sign in to comment.