Travis CI,根据标签部署到2个应用程序

时间:2016-07-29 10:09:53

标签: travis-ci

期望的目标(伪代码)

if (tag) { deploy to live-app}
else { deploy to test-app}

我尝试过的事情:

deploy:
  provider: heroku
  app: live-app
  api_key:
    secure: ...

deploy:
  provider: heroku
  app: test-app
  on: 
    tags: true
    all_branches: true # needed due to travis limitation, we deploy only on master
  api_key:
    secure: ...

这导致travis忽略了对测试应用程序的第一次部署设置。

任何想法?

我知道我可以编写自己的脚本来做到这一点,只是想知道是否有更清洁的" travisy"解决方案,因为这听起来像一个非常常见的场景

1 个答案:

答案 0 :(得分:1)

试试这样:

deploy:
    - provider: heroku
      app: live-app
      api_key:
        secure: ...
      on:
        tags: false

    - provider: heroku
      app: test-app
      on: 
        tags: true
        all_branches: true # needed due to travis limitation, we deploy only on master
      api_key:
      secure: ...