I am working on jenkins, maven, git project. I want to set the version in pom file to auto increment in every new build. I got the version using below command. Version no is 0.0.1.
grep -ri "<version>" pom.xml |head -n 1 | sed -e 's/^[ \t]*<version>\([^<]*\)
<.*$/\1/' | sed 's/[-SNAPSHOT]//g'
Now I want to set that values into variables and increment the version in every new build. How can I do it? Is it possible to do? Next build output should be 0.0.2.
Can't I set 0.0.1
output into varibales like major
, minor
, bug
and set $bug+1
.