Consider TRAVIS_BRANCH env variable when determining branch

The previous approach does not work with detached HEADs.