aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
492 stars 182 forks source link

Hotfix-start add hotfixVersionDigitToIncrement parameter #186

Closed SergeZh4Dev closed 3 years ago

SergeZh4Dev commented 5 years ago

Often hotfix version has 1 more digit than release one. E.g. release is 1.2 and hotfix is 1.2.1. But at the moment it is not supported. Hotfix now is next version in production branch (in our case 1.3). If there were hotfixes earlier and production version is already 1.2.1 then next hotfix is endeed 1.2.2. But if there were no hotfixes yet to support right behaiviour we need to specify release version with last zero - 1.2.0. This forces us to declare development version with 3 digits 1.2.0-SNAPSHOT. But if we have no need to have 3 digits in development version then we need a way to tell plugin which digit it should increment at hotfix start. So we need something like versionDigitToIncrement, but for hotfix. And getHotfixVersion func must use it but check if this parameter equals to current production version digits counts (as this parameter as well as versionDigitToIncrement would be zero-based) then just add one more digit to version with value of "1". After this we can have development version with 2 digits - 1.2-SNAPSHOT (and versionDigitToIncrement set to 1). Release would be 1.2 (with is equals to 1.2.0 for maven). And first hotfix would create 1.2.1 (if hotfixVersionDigitToIncrement is set to 2). And subsequent hotfixes would be 1.2.2, 1.2.3 and so on.

erikhusby commented 4 years ago

As part of my conversion from jgitflow-maven-plugin to gitflow-maven-plugin, I had to write a script to do this calculation. It had been part of the jgitflow plugin. I have in place special builds that start a release or a hotfix and also finish the release or hotfix. This allows others in the team to easily do these tasks when I am not around. Having this feature would simplify my builds.

dkirchner-qc commented 4 years ago

What worked for us is to change the version of you project to 3 digits, aka 1.2 to 1.2.0 a hotfix on that would increment to 1.2.1