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

@ -0,0 +1,39 @@
#!/usr/bin/env bash
# WARNING: FIREBASE_TOKEN should NOT be printed.
set +x -eu -o pipefail
readonly deployEnv=$1
case $deployEnv in
staging)
readonly projectId=aio-staging
readonly deployedUrl=https://$projectId.firebaseapp.com/
readonly firebaseToken=$FIREBASE_TOKEN
;;
production)
readonly projectId=angular-io
readonly deployedUrl=https://angular.io/
readonly firebaseToken=$FIREBASE_TOKEN
;;
*)
echo "Unknown deployment environment ('$deployEnv'). Expected 'staging' or 'production'."
exit 1
;;
esac
(
cd "`dirname $0`/.."
# Build the app
yarn build
# Deploy to Firebase
firebase use "$projectId" --token "$firebaseToken"
firebase deploy --message "Commit: $TRAVIS_COMMIT" --non-interactive --token "$firebaseToken"
# Run PWA-score tests
# TODO(gkalpak): Figure out why this fails and re-enable.
yarn test-pwa-score -- "$deployedUrl" "$MIN_PWA_SCORE" "$PWA_RESULTS_LOG" || true
)