ci(aio): deploy commits on the stable branch to production

The current stable branch is determined based on the current version mapped to
the npm `latest` tag (by replacing the patch version number with 'x' - e.g.
`1.2.3` --> `1.2.x`).
PRs against the stable branch will be deployed to the preview server (as long as
the rest of the requirements are met). Commits on the stable branch itself will
be deployed to production.

Fixes #16908
This commit is contained in:
Georgios Kalpakas
2017-05-23 11:36:02 +03:00
committed by Alex Rickabaugh
parent ed73d4f3ac
commit 234268eec2
7 changed files with 74 additions and 50 deletions

View File

@ -44,10 +44,10 @@ if [[ ${CI_MODE:-} == "aio" ]]; then
cd "`dirname $0`/../../aio"
yarn build
# If this is a PR for angular/angular@master, deploy a snapshot for previewing early
# (if preconditions are met) regardless of the test outcome.
# If this is a PR for angular/angular@master or angular/angular@<stable-branch>, deploy a
# snapshot for previewing early (if preconditions are met) regardless of the test outcome.
if [[ ${TRAVIS_REPO_SLUG} == "angular/angular" ]] &&
[[ ${TRAVIS_BRANCH} == "master" ]] &&
([[ $TRAVIS_BRANCH == "master" ]] || [[ $TRAVIS_BRANCH == $STABLE_BRANCH ]]) &&
[[ $TRAVIS_PULL_REQUEST != "false" ]]; then
travisFoldStart "deploy.aio.pr-preview"
yarn deploy-preview -- --skip-build

View File

@ -40,24 +40,33 @@ case ${CI_MODE} in
travisFoldEnd "deploy.packages"
;;
aio)
# 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
# Only deploy if this not a PR. PRs are deployed early in `build.sh`.
if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then
travisFoldStart "deploy.aio"
(
cd ${TRAVIS_BUILD_DIR}/aio
# Only deploy if this not a PR. PRs are deployed early in `build.sh`.
if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then
# This is upstream master: Deploy to staging
travisFoldStart "deploy.aio.staging"
yarn deploy-staging
travisFoldEnd "deploy.aio.staging"
# 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
)
travisFoldEnd "deploy.aio"
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
)
travisFoldEnd "deploy.aio"
fi
;;
esac

View File

@ -59,6 +59,10 @@ if [[ ${TRAVIS:-} ]]; then
setEnvVar KARMA_JS_BROWSERS `node -e "console.log(require('/home/travis/build/angular/angular/browser-providers.conf').browserstackAliases.CI_OPTIONAL.join(','))"`
;;
aio)
# Determine the current stable branch.
readonly versionRe="^\s*([0-9]+\.[0-9]+)\.[0-9]+.*$"
setEnvVar STABLE_BRANCH `npm info @angular/core dist-tags.latest | sed -r "s/$versionRe/\1.x/"`
setEnvVar MIN_PWA_SCORE 95
;;
esac