简体   繁体   中英

pass env variables to travis specific to deployment

i have the following .travis.yaml file:

branches:
  only:
    - master
    - develop
language: node_js
node_js:
  - "7.9.0"
script:
  - make build
deploy:
  - provider: s3
    local_dir: build
    acl: public_read
    skip_cleanup: true
    bucket: "app-dev-us-east-1"
    region: "us-east-1"
    on:
      branch: develop
  - provider: s3
    local_dir: build
    acl: public_read
    skip_cleanup: true
    bucket: "app-prod-us-east-1"
    region: "us-east-1"
    on:
      branch: master

in my script: make build, what is the correct way to pass a different env variable based on the branch that is being built?

or do i have to modify my makefile and pull the TRAVIS_BRANCH and use that?

any advise is much appreciated

Actually this question was already asked before .

One of answers says that you can have different .travis.yml on each branch. However the issue would be with merging between those branches. But you can always add .travis.yml to .gitignore to ignore these differences during merge.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM