-
Notifications
You must be signed in to change notification settings - Fork 27.4k
chore(travis): fix deploy conditions #16296
Conversation
scripts/travis/build.sh
Outdated
@@ -62,6 +64,8 @@ case "$JOB" in | |||
# - or the branch distTag from package.json is "latest" (i.e. stable branch) | |||
if [[ "$TRAVIS_TAG" != '' || "$TRAVIS_BRANCH" == master || "$DIST_TAG" == latest ]]; then | |||
DEPLOY_CODE=true | |||
else | |||
DEPLOY_CODE=false | |||
fi | |||
|
|||
if [[ "$DEPLOY_DOCS" || "$DEPLOY_CODE" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will always evaluate to true, even if both are false
(because false
is truthy 😃)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, good catch. Bash script doesn't have boolean true / false.
You can see here how this condition fails, but the actual deploy conditions are correct: https://travis-ci.org/angular/angular.js/jobs/290626171
@@ -90,5 +99,5 @@ jobs: | |||
on: | |||
repo: angular/angular.js | |||
all_branches: true | |||
condition: $DEPLOY_CODE | |||
condition: "$DEPLOY_CODE == true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this works? (I would expect this to always evaluate to true).
Maybe condition: env(DEPLOY_CODE) = true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that works. https://unix.stackexchange.com/a/16110
I've just added the quote marks to make it explicit that this belongs together. The quote marks are only for yaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to accessing $DEPLOY_CODE
directly. I thought these docs applied to condition
as well, but I now see it is only for if
s. These docs apply to condition
, so it is fine indeed 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was less than thrilled when I noticed that they are using a special language for the deploy conditions. I should visit them some time and chew them out for lack of consistency ... (they are from Berlin)
@@ -78,7 +87,7 @@ jobs: | |||
on: | |||
repo: angular/angular.js | |||
all_branches: true | |||
condition: $DEPLOY_DOCS | |||
condition: "$DEPLOY_DOCS == true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this works? (I would expect this to always evaluate to true).
Maybe condition: env(DEPLOY_DOCS) = true
?
13789d0
to
14e67aa
Compare
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change?
Please check if the PR fulfills these requirements
Other information: