Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How you increment the version number using Travis CI?

The project that I am working on is a jQuery plugin. I have managed to get Travis CI to build a test project using Gulp/NodeJS successfully. Now I am trying to work out what workflow to use to bump the version number.

In TeamCity and MyGet there is a setting in the CI server to form a version number pattern that auto increments on each build, which can be used by the build script to update versions in the deployment files and to label the Git repo. However, in the free version of Travis CI, there doesn't seem to be an option for versioning at all.

I have read several articles on continuous deployment with Travis CI, here, here, and here, but none of them even broach the topic of versioning. Obviously, the version needs to be changed for the release. So what am I missing here?

Another problem I noted when going through the documentation is that it mentioned that Travis CI is not able to update the GitHub repository. Doesn't that basically mean it won't be able to create a Git tag?

If there is no way to version from Travis CI, then what is the typical workflow for the release process for such a plugin? Is the versioning always done manually? If so, how could there be "continuous deployment"?

like image 722
NightOwl888 Avatar asked Apr 19 '15 15:04

NightOwl888


People also ask

Is Travis CI a CI CD tool?

Like Jenkins, Travis CI is also one of the early players in the CI/CD tools market. The tool is written in Ruby and is developed & maintained by the Travis CI community. Travis CI was earlier available only for GitHub hosted projects but now it also supports Bitbucket hosted projects.

Is Travis a build tool?

Travis CI is a hosted continuous integration service used to build and test software projects hosted on GitHub and Bitbucket.


1 Answers

Before it starts running the instructions in your .travis.yml file, Travis will set a bunch of environment variables (in the VM that is building your project) with various bits of information about your build, such as what branch is being built and so on.

You probably want one of these:

  • TRAVIS_BUILD_NUMBER: The number of the current build (for example, “4”).
  • TRAVIS_JOB_NUMBER: The number of the current job (for example, “4.1”).

But it's going to be very difficult to do anything sensible if you don't have control of the repository, because you'll need to upload a .travis.yml file into the root of your source code folder, otherwise Travis won't know what to do.

like image 164
Beetle Avatar answered Sep 19 '22 04:09

Beetle