I have an open source project, and I want to deploy the code only if the code is in the main branch, I have already tried many approaches, for example:
- if [[ $TRAVIS_BRANCH == 'master' ]]; then fab deploy; fi
Or something like:
BRANCH = "master" def _get_local_branch(): return local("git rev-parse --abbrev-ref HEAD", capture=True) def deploy(): local_branch = _get_local_branch() if local_branch == BRANCH: print green("Deploy succefully done!") print yellow("Deploy allowed just in the master branch.")
But this does not work, even in other branches of people, the fab deploy command was called.
source share