mattrowesboats
mattrowesboats

Reputation: 592

How can I use an environment variable to specify branches to build in .travis.yml?

In the TravisCI webapp, I've specified an environment variable called "BUILD_BRANCH". I would like to use this variable in the .travis.yml branch declaration, but TravisCI is reading it as a literal string "$BUILD_BRANCH".

I've looked for examples and references of this type of usage online and couldn't find any. I've also emailed them for support but they haven't gotten back to me yet.

branches:
    only:
        - $BUILD_BRANCH

I've tried both "$BUILD_BRANCH" and "${BUILD_BRANCH}".

Upvotes: 0

Views: 178

Answers (1)

joepd
joepd

Reputation: 4841

Environment variables are expanded in the build, not in the place where the build matrix is expanded in jobs to be run. You would need to hard code this value.

Upvotes: 1

Related Questions