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". If the `TRAVIS_BRANCH` matches the `STABLE_BRANCH` we deploy as "stable". Otherwise if the branch has a major version lower than the stable version and its minor version is highest of similar branches we deploy as "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 Closes #18297
53 lines
1.5 KiB
Bash
Executable File
53 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -u -e -o pipefail
|
|
|
|
# Setup environment
|
|
readonly thisDir=$(cd $(dirname $0); pwd)
|
|
source ${thisDir}/_travis-fold.sh
|
|
|
|
|
|
# If the previous commands in the `script` section of .travis.yaml failed, then abort.
|
|
# The variable is not set in early stages of the build, so we default to 0 there.
|
|
# https://docs.travis-ci.com/user/environment-variables/
|
|
if [[ ${TRAVIS_TEST_RESULT=0} == 1 ]]; then
|
|
exit 1;
|
|
fi
|
|
|
|
|
|
# Don't deploy if not running against angular/angular
|
|
# TODO(i): because we don't let deploy to run outside of angular/angular folks can't use their
|
|
# private travis build to deploy anywhere. This is likely ok, but this means that @alexeagle's
|
|
# fancy setup to publish ES2015 packages to github -build repos no longer works. This is ok
|
|
# since with flat modules we'll have this feature built-in. We should still go and remove
|
|
# stuff that Alex put in for this from publish-build-artifacts.sh
|
|
if [[ ${TRAVIS_REPO_SLUG} != "angular/angular" ]]; then
|
|
echo "Skipping deploy because this is not angular/angular."
|
|
exit 0
|
|
fi
|
|
|
|
|
|
case ${CI_MODE} in
|
|
|
|
e2e)
|
|
# Don't deploy if this is a PR build
|
|
if [[ ${TRAVIS_PULL_REQUEST} != "false" ]]; then
|
|
echo "Skipping deploy because this is a PR build."
|
|
exit 0
|
|
fi
|
|
|
|
travisFoldStart "deploy.packages"
|
|
${thisDir}/publish-build-artifacts.sh
|
|
travisFoldEnd "deploy.packages"
|
|
;;
|
|
|
|
aio)
|
|
travisFoldStart "deploy.aio"
|
|
(
|
|
cd ${TRAVIS_BUILD_DIR}/aio
|
|
yarn deploy-production
|
|
)
|
|
travisFoldEnd "deploy.aio"
|
|
;;
|
|
esac
|