From 9dd550fa1e1ba710055b683d1c6cb87bd499fd3d Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Sat, 8 Jul 2017 02:35:07 +0300 Subject: [PATCH] ci(aio): only deploy latest commits to staging/production (#17988) Fixes #17941 --- aio/scripts/deploy-to-firebase.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aio/scripts/deploy-to-firebase.sh b/aio/scripts/deploy-to-firebase.sh index 24279d6648..a14ba8965b 100755 --- a/aio/scripts/deploy-to-firebase.sh +++ b/aio/scripts/deploy-to-firebase.sh @@ -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`/.."