kagarlickij
kagarlickij

Reputation: 8107

Travis CI build number for each branch

I have Android app located in GitHub repo connected to Travis CI, and I have a few branches e.g. master for production, dev for development, qa for testing, etc.

I'd like to include build number as a part of artifact name, e.g. 0.3.0-SNAPSHOT.53 for development or 0.2.0-RC.12 for testing.

Obviously Travis CI build number should be unique for different branches. Is it possible?

Upvotes: 2

Views: 1164

Answers (1)

Luna G.
Luna G.

Reputation: 156

The TRAVIS_BRANCH and TRAVIS_BUILD_NUMBER environment variables can be used to access those details about the build. Additional information about this can be found in the Default Environment Variables section of Travis CI's documentation.

Where and how you use these environment variables will depend on what you need to do but as a general note, they're accessed using the $TRAVIS_BRANCH syntax.

Happy to elaborate on anything if needed. Hope this helps!

Upvotes: 2

Related Questions