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

Commit 13789d0

Browse files
committed
chore(travis): fix deploy conditions
1 parent dfcb5ac commit 13789d0

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.travis.yml

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

scripts/travis/build.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ case "$JOB" in
3636
export USE_JQUERY=1
3737
fi
3838

39-
export TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
40-
4139
if [[ "$TEST_TARGET" == jquery* ]]; then
4240
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
41+
else
42+
TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
4343
fi
4444

45-
export TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
45+
TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
4646
grunt test:travis-protractor --specs="$TARGET_SPECS"
4747
;;
4848
"deploy")
@@ -54,6 +54,8 @@ case "$JOB" in
5454
# upload docs if the branch distTag from package.json is "latest" (i.e. stable branch)
5555
if [[ "$DIST_TAG" == latest ]]; then
5656
DEPLOY_DOCS=true
57+
else
58+
DEPLOY_DOCS=false
5759
fi
5860

5961
# upload the build (code + docs) if ...
@@ -62,6 +64,8 @@ case "$JOB" in
6264
# - or the branch distTag from package.json is "latest" (i.e. stable branch)
6365
if [[ "$TRAVIS_TAG" != '' || "$TRAVIS_BRANCH" == master || "$DIST_TAG" == latest ]]; then
6466
DEPLOY_CODE=true
67+
else
68+
DEPLOY_CODE=false
6569
fi
6670

6771
if [[ "$DEPLOY_DOCS" || "$DEPLOY_CODE" ]]; then

0 commit comments

Comments
 (0)