Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 202f180

Browse files
authored
chore(travis): fix deploy conditions
Closes #16296
1 parent 32fbb2e commit 202f180

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

.travis.yml

+20-11
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,31 @@ jobs:
5454
include:
5555
- stage: deploy
5656
# Don't deploy from PRs.
57-
# The deployment logic for pushed branches is defined in scripts\travis\build.sh
57+
# This is a Travis-specific boolean language: https://docs.travis-ci.com/user/conditional-builds-stages-jobs#Specifying-conditions
58+
# The deployment logic for pushed branches is further defined in scripts\travis\build.sh
5859
if: type != pull_request
5960
env:
6061
- JOB=deploy
6162
before_script: skip
6263
script:
63-
- "./scripts/travis/build.sh"
64+
# Export the variables into the current process
65+
- . ./scripts/travis/build.sh
66+
- "echo DEPLOY_DOCS: $DEPLOY_DOCS, DEPLOY_CODE: $DEPLOY_CODE"
67+
after_script: skip
6468
# Work around the 10min Travis timeout so the code.angularjs firebase+gcs code deploy can complete
69+
# Only run the keep_alive once (before_deploy is run for each provider)
6570
before_deploy: |
66-
function keep_alive() {
67-
while true; do
68-
echo -en "\a"
69-
sleep 5
70-
done
71-
}
72-
keep_alive &
71+
if ! [ "$BEFORE_DEPLOY_RUN" ]; then
72+
export BEFORE_DEPLOY_RUN=1;
73+
74+
function keep_alive() {
75+
while true; do
76+
echo -en "\a"
77+
sleep 10
78+
done
79+
}
80+
keep_alive &
81+
fi
7382
deploy:
7483
- provider: firebase
7584
# the upload folder for firebase is configured in /firebase.json
@@ -79,7 +88,7 @@ jobs:
7988
on:
8089
repo: angular/angular.js
8190
all_branches: true
82-
condition: $DEPLOY_DOCS
91+
condition: "$DEPLOY_DOCS == true"
8392
- provider: gcs
8493
skip_cleanup: true
8594
access_key_id: GOOGLDB7W2J3LFHICF3R
@@ -91,5 +100,5 @@ jobs:
91100
on:
92101
repo: angular/angular.js
93102
all_branches: true
94-
condition: $DEPLOY_CODE
103+
condition: "$DEPLOY_CODE == true"
95104

scripts/travis/build.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ case "$JOB" in
4646
export USE_JQUERY=1
4747
fi
4848

49-
export TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
50-
5149
if [[ "$TEST_TARGET" == jquery* ]]; then
5250
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
51+
else
52+
TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
5353
fi
5454

55-
export TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
55+
TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
5656
grunt test:travis-protractor --specs="$TARGET_SPECS"
5757
;;
5858
"deploy")
@@ -64,6 +64,8 @@ case "$JOB" in
6464
# upload docs if the branch distTag from package.json is "latest" (i.e. stable branch)
6565
if [[ "$DIST_TAG" == latest ]]; then
6666
DEPLOY_DOCS=true
67+
else
68+
DEPLOY_DOCS=false
6769
fi
6870

6971
# upload the build (code + docs) if ...
@@ -72,9 +74,11 @@ case "$JOB" in
7274
# - or the branch distTag from package.json is "latest" (i.e. stable branch)
7375
if [[ "$TRAVIS_TAG" != '' || "$TRAVIS_BRANCH" == master || "$DIST_TAG" == latest ]]; then
7476
DEPLOY_CODE=true
77+
else
78+
DEPLOY_CODE=false
7579
fi
7680

77-
if [[ "$DEPLOY_DOCS" || "$DEPLOY_CODE" ]]; then
81+
if [[ "$DEPLOY_DOCS" == true || "$DEPLOY_CODE" == true ]]; then
7882
grunt prepareFirebaseDeploy
7983
else
8084
echo "Skipping deployment build because conditions have not been met."

0 commit comments

Comments
 (0)