ci(aio): only deploy latest commits to staging/production (#17988)

Fixes #17941
This commit is contained in:
George Kalpakas 2017-07-08 02:35:07 +03:00 committed by Jason Aden
parent abbac4bc69
commit 9dd550fa1e
1 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,14 @@ case $deployEnv in
;;
esac
# Do not deploy if the current commit is not the latest on its branch.
readonly LATEST_COMMIT=$(git ls-remote origin $TRAVIS_BRANCH | cut -c1-40)
if [ $TRAVIS_COMMIT != $LATEST_COMMIT ]; then
echo "Skipping deploy because $TRAVIS_COMMIT is not the latest commit ($LATEST_COMMIT)."
exit 0
fi
# Deploy
(
cd "`dirname $0`/.."