是否可以在 travis 中设置条件环境变量? [英] Is it possible to set conditional environment variables in travis?

查看:37
本文介绍了是否可以在 travis 中设置条件环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 5 个版本的 nodeJS 上运行 travis,.travis.yml 是 ....

I am running on travis on 5 versions of nodeJS, .travis.yml is ....

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 环境变量

I want to set a travis environment variable for the run on nodeJS 5.0 only

像这样......

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

但这是无效的......任何人都知道如何做到这一点......

but this is invalid ... anyone know how to do this ...

1 - 最好通过 .travis.yml

1 - Preferably, via .travis.yml

2 - 如果没有,通过 travis 网络应用程序

2 - If not, through the travis web application

我知道如何通过代码做到这一点 - 但是可以通过 travis 完成吗?

I KNOW HOW TO DO THIS VIA CODE - But can it be done through travis?

谢谢大家

推荐答案

如何使用矩阵显式包含环境变量设置为 true 的5.0"构建(请参阅 关于显式包含构建的文档).

What about using the matrix to explicitly include the one "5.0" build where your environment variable is set to true (see 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 中设置条件环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆