ci(aio): only deploy a preview if the PR touched relevant files

This commit is contained in:
Georgios Kalpakas 2017-03-06 22:31:43 +02:00 committed by Chuck Jazdzewski
parent b4ec80b21d
commit 093d69f0f0
1 changed files with 7 additions and 1 deletions

View File

@ -53,7 +53,13 @@ case ${CI_MODE} in
if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then
# This is a PR: deploy a snapshot for previewing
travisFoldStart "deploy.aio.pr-preview"
yarn run deploy-preview
# Only deploy if this PR has touched relevant files.
AIO_CHANGED_FILES_COUNT=$(git diff --name-only $TRAVIS_COMMIT_RANGE | grep ^aio/ | wc -l)
if [[ AIO_CHANGED_FILES_COUNT -eq 0 ]]; then
echo "Skipping deploy because this PR did not touch any files inside 'aio/'."
else
yarn run deploy-preview
fi
travisFoldEnd "deploy.aio.pr-preview"
else
# This is upstream master: Deploy to staging