Skip to content

Commit

Permalink
allow multiple attempts to push ghpages
Browse files Browse the repository at this point in the history
There's a synchrony problem with Travis-CI, where the GitHub repo locks
when it's being pushed to, so if another build is pushing at the same time,
pushing will return in error
  • Loading branch information
KristoforMaynard committed Nov 12, 2015
1 parent 6a70ec3 commit c2c8266
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion deploy_ghpages
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,28 @@ if [ "$(git diff --name-only --cached)" != "" ]; then
echo "[PRETEND] ${msg}"
else
git commit -m "${msg}"
git push

push_errcode=1
max_push_tries=5
push_tries=0
set +e
while [[ push_errcode -ne 0 && ${push_tries} -lt ${max_push_tries} ]]; do
echo "Push attempt ${push_tries}"
git push
push_errcode=$?
push_tries=$((${push_tries} + 1))
if [ ${push_errcode} -ne 0 ]; then
sleep 2
fi
done
set -e

if [ ${push_errcode} -eq 0 ]; then
echo "Push succeeded after ${push_tries} attempt(s)"
else
echo "Push failed ${push_tries} times"
exit ${push_errcode}
fi
fi
else
echo "No changes made, so no commit for you"
Expand Down

0 comments on commit c2c8266

Please sign in to comment.