Travis conditional on branch after_success

use the test command as used here.

after_success:
  - test $TRAVIS_BRANCH = "master" &&
    ember build

All travis env variables are available here.


You can execute shell script in after_success and check the current branch using travis environment variables:

#!/bin/sh

if [[ "$TRAVIS_BRANCH" != "master" ]]; then
  echo "We're not on the master branch."
  # analyze current branch and react accordingly
  exit 0
fi

Put the script somewhere in the project and use it like:

after_success:
- ./scripts/deploy_to_s3.sh

There might be other useful travis variables to you, they are listed here.

Tags:

Travis Ci