Looking for a way automate the "bump version" with git flow

spdaly picture spdaly · Apr 19, 2012 · Viewed 17.3k times · Source

I have been using git flow for a couple of months and it has worked very well. I would like to automate the "bump version" operation.

The project is PHP and the footer.php has a token to replace with the current release tag. I am certain that with some awk'ing of git log and the PHP file everything should work out, but I assume someone has done this before...

Any ideas?

Answer

AD7six picture AD7six · May 23, 2012

You could use the semver gem, which adds a file .semver to the root of your git repo. Semantic version numbers are a recommendation for having structured/consistent/meaningful version numbers, the gem just makes it easy to implement.

So, all you'd need to do is add:

semver inc major|minor|patch

into your workflow (manually or scripted) so that the .semver gets updated during a release.

If you don't want the ruby dependency, semver is pretty simple, so a bit of sed experimentation will likely yield a working solution.