TravisCI: Run after_success on a specific branch

柔情痞子 提交于 2019-12-03 09:59:11

I solved it by writing a simple script using TRAVIS_BRANCH environment variable and executed the script in after_success

.travis.yml

after_success:
- ./deploy.sh

deploy.sh

#!/bin/bash
if [ "$TRAVIS_BRANCH" == "prod" ]; then
  // do the deploy
fi

You can also do this by using the script provider in the deploy phase of your build. This approach is a bit cleaner but only allows one command, unlike after_success.

deploy:
  provider: script
  script: # some deployment script
  on:
    branch: prod
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!