是否可以在travis中设置条件环境变量?
Is it possible to set conditional environment variables in travis?
我运行在 5 个版本的 nodeJS 上使用 travis,.travis.yml 是 ....
language: node_js
node_js:
- 5.0
- 4.0
- 0.12.7
- 0.10.40
- 0.10.36
before_install:
- npm install -g grunt-cli
script:
- npm run travis
我只想在 nodeJS 5.0 上为 运行 设置一个 travis 环境变量
像这样...
language: node_js
node_js:
- 5.0
- env: POST_TO_COVERALLS=true
- 4.0
- 0.12.7
- 0.10.40
- 0.10.36
before_install:
- npm install -g grunt-cli
script:
- npm run travis
但这无效...任何人都知道该怎么做...
1 - 最好通过 .travis.yml
2 - 如果没有,通过 travis web 应用程序
我知道如何通过代码执行此操作 - 但它可以通过 travis 完成吗?
谢谢大家
如何使用矩阵明确包含环境变量设置为 true 的“5.0”构建(请参阅 documentation on explicitly including builds)。
会像下面这样
language: node_js
node_js:
- 4.0
- 0.12.7
- 0.10.40
- 0.10.36
env:
POST_TO_COVERALLS=false
matrix:
include:
- node_js: 5.0
env: POST_TO_COVERALLS=true
before_install:
- npm install -g grunt-cli
script:
- npm run travis
新引入的 Travis build stages 结合一些 YML 继承和一些围绕分配 Bash 变量的技巧可以非常方便:
jobs:
include:
- stage: Tests
script: # run tests
- script: # run more tests
- &deploy-stuff
stage: Deploy
if: branch != master
env:
- ENV=$(if [ "$SOMETHING" = "thing" ]; then echo ${TRAVIS_BRANCH//\//-}; else echo "staging"; fi)
script: # do some things before deploy
deploy:
- provider: script
skip_cleanup: true
script: echo $ENV
on:
all_branches: true
condition: $TRAVIS_BRANCH = "devel" || $SOMETHING = "thing"
- <<: *deploy-stuff
if: branch = master
env:
- ENV="production"
deploy:
- provider: script
skip_cleanup: true
script: echo $ENV
on:
branch: master
我运行在 5 个版本的 nodeJS 上使用 travis,.travis.yml 是 ....
language: node_js
node_js:
- 5.0
- 4.0
- 0.12.7
- 0.10.40
- 0.10.36
before_install:
- npm install -g grunt-cli
script:
- npm run travis
我只想在 nodeJS 5.0 上为 运行 设置一个 travis 环境变量
像这样...
language: node_js
node_js:
- 5.0
- env: POST_TO_COVERALLS=true
- 4.0
- 0.12.7
- 0.10.40
- 0.10.36
before_install:
- npm install -g grunt-cli
script:
- npm run travis
但这无效...任何人都知道该怎么做...
1 - 最好通过 .travis.yml
2 - 如果没有,通过 travis web 应用程序
我知道如何通过代码执行此操作 - 但它可以通过 travis 完成吗?
谢谢大家
如何使用矩阵明确包含环境变量设置为 true 的“5.0”构建(请参阅 documentation on explicitly including builds)。
会像下面这样
language: node_js
node_js:
- 4.0
- 0.12.7
- 0.10.40
- 0.10.36
env:
POST_TO_COVERALLS=false
matrix:
include:
- node_js: 5.0
env: POST_TO_COVERALLS=true
before_install:
- npm install -g grunt-cli
script:
- npm run travis
新引入的 Travis build stages 结合一些 YML 继承和一些围绕分配 Bash 变量的技巧可以非常方便:
jobs:
include:
- stage: Tests
script: # run tests
- script: # run more tests
- &deploy-stuff
stage: Deploy
if: branch != master
env:
- ENV=$(if [ "$SOMETHING" = "thing" ]; then echo ${TRAVIS_BRANCH//\//-}; else echo "staging"; fi)
script: # do some things before deploy
deploy:
- provider: script
skip_cleanup: true
script: echo $ENV
on:
all_branches: true
condition: $TRAVIS_BRANCH = "devel" || $SOMETHING = "thing"
- <<: *deploy-stuff
if: branch = master
env:
- ENV="production"
deploy:
- provider: script
skip_cleanup: true
script: echo $ENV
on:
branch: master