ci(aio): create previews for all PRs that touch non-spec files in aio/ or packages/ (#16733)

Previously, no previews would be deployed for PRs that didn't touch files inside
`aio/`. Now, previews will be deployed for PRs that touch non-spec files inside
either `aio/` or `packages/` (as long as other preconditions are met).

Partially addresses #16526.
This commit is contained in:
George Kalpakas
2017-05-12 01:02:13 +03:00
committed by Igor Minar
parent 44c7ac0fe9
commit decb4cc4a3
2 changed files with 44 additions and 36 deletions

View File

@ -40,9 +40,9 @@ case ${CI_MODE} in
travisFoldEnd "deploy.packages"
;;
aio)
# Don't deploy if this build is not for master or aio-master
if [[ ${TRAVIS_BRANCH} != "master" && ${TRAVIS_BRANCH} != "aio-master" ]]; then
echo "Skipping deploy because this build is not for master or aio-master."
# Don't deploy if this build is not for master
if [[ ${TRAVIS_BRANCH} != "master" ]]; then
echo "Skipping deploy because this build is not for master."
exit 0
fi
@ -51,34 +51,10 @@ case ${CI_MODE} in
cd ${TRAVIS_BUILD_DIR}/aio
if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then
# This is a PR: deploy a snapshot for previewing
# This is a PR: deploy a snapshot for previewing (if preconditions met)
travisFoldStart "deploy.aio.pr-preview"
# Only deploy if this PR has touched relevant files.
readonly 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
# Only deploy if this PR meets certain preconditions.
readonly AIO_PREVERIFY_EXIT_CODE=$(./aio-builds-setup/scripts/travis-preverify-pr.sh && echo 0 || echo $?)
case $AIO_PREVERIFY_EXIT_CODE in
2)
# An error occurred: Fail the build
exit 1;
;;
1)
# Preconditions not met: Skip deploy
echo "Skipping deploy because this PR did not meet the preconditions."
;;
0)
# Preconditions met: Deploy
yarn deploy-preview
;;
esac
fi
yarn deploy-preview
travisFoldEnd "deploy.aio.pr-preview"
elif [[ ${TRAVIS_BRANCH} == "aio-master" ]]; then
# This is upstream aio-master: Don't deploy to staging
echo "Skipping deploy to staging because this build is for upstream aio-master."
else
# This is upstream master: Deploy to staging
travisFoldStart "deploy.aio.staging"