ci(aio): compute AIO deployment mode

There are now 3 modes for deployment: next, stable, archive.
We compute which mode (and other deployment properties)
from the `TRAVIS_BRANCH` and the `STABLE_BRANCH`.

If the TRAVIS_BRANCH is master we deploy as "next".
Otherwise if the branch is the highest of its minor versions
we deploy as "stable" if the `TRAVIS_BRANCH` matches the `STABLE_BRANCH` or
else "archive".

For "archive" deployments we compute the firebase project and deployment
url based on the major version of the `TRAVIS_BRANCH`.

As well as choosing where to deploy the build, we also use this
to select the environment file for the AIO Angular app.
This will enable the app to change its rendering and behaviour
based on its mode.

See #18287
This commit is contained in:
Peter Bacon Darwin
2017-07-27 16:12:04 +01:00
committed by Victor Berchet
parent ca695e0632
commit bcb36d9b6d
9 changed files with 87 additions and 58 deletions

View File

@ -28,6 +28,7 @@ fi
case ${CI_MODE} in
e2e)
# Don't deploy if this is a PR build
if [[ ${TRAVIS_PULL_REQUEST} != "false" ]]; then
@ -39,34 +40,14 @@ case ${CI_MODE} in
${thisDir}/publish-build-artifacts.sh
travisFoldEnd "deploy.packages"
;;
aio)
# Only deploy if this not a PR. PRs are deployed early in `build.sh`.
if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then
# Don't deploy if this build is not for master or the stable branch.
if [[ $TRAVIS_BRANCH != "master" ]] && [[ $TRAVIS_BRANCH != $STABLE_BRANCH ]]; then
echo "Skipping deploy because this build is not for master or the stable branch ($STABLE_BRANCH)."
exit 0
fi
travisFoldStart "deploy.aio"
(
cd ${TRAVIS_BUILD_DIR}/aio
if [[ $TRAVIS_BRANCH == $STABLE_BRANCH ]]; then
# This is upstream <stable-branch>: Deploy to production.
travisFoldStart "deploy.aio.production"
yarn deploy-production
travisFoldEnd "deploy.aio.production"
else
# This is upstream master: Deploy to staging.
travisFoldStart "deploy.aio.staging"
yarn deploy-staging
travisFoldEnd "deploy.aio.staging"
fi
yarn deploy-production
)
travisFoldEnd "deploy.aio"
fi
;;
esac