maven-git-versioning-extension icon indicating copy to clipboard operation
maven-git-versioning-extension copied to clipboard

Add an option to reuse values captured from ref to search a tag

Open mrozanc opened this issue 1 year ago • 2 comments
trafficstars

I have this use case where I have branches containing a part of the version, but I need to resolve the rest of the version from the previous tags.

For example, release/2.3 will set the base version to 2.3.0 but on this branch, the release is still in preparation, so I need to check for specific tags that match the version from the branch (2.3.0-rc.1 and other increments starting with 2.3) in order to not mix any other tag versions with the release to go.

I implemented a way to put placeholders in the describeTagPattern to find the right tags, like:

<ref type="branch">
  <pattern><![CDATA[release/(?<major>\d+)\.(?<minor>\d+)(?:\.x)?]]></pattern>
  <describeTagPattern>\Qrelease-marker-{{ref.major}}.{{ref.minor}}\E</describeTagPattern>
  <version>${ref.major}.${ref.minor}.0-rc.${describe.distance}-SNAPSHOT</version>
</ref>

The idea is that {{ is normally not valid for regex if not escaped. If the key found is not part of the map, the placeholder is left untouched.

mrozanc avatar Sep 22 '24 01:09 mrozanc