symplify icon indicating copy to clipboard operation
symplify copied to clipboard

Add possibility to limit most recent tag resolver's scope to the recent branch

Open jakubtobiasz opened this issue 1 year ago • 0 comments

Hello 👋🏼!

I'm actively working to be able to support multiple branches (so you can support e.g. both 1.x and 2.x version of your software) using monorepo-builder and monorepo-split-github-action.

This is a first PR of X (as I don't know how many PRs are required to achieve my goal 😅).

This PR provides the possibility to limit resolving the most recent tag to the current branch. By default we're using git tag -l --sort=committerdate command which returns the most recent tag from the whole repository. I've added limit_recent_tag_resolving_scope_to_current_branch parameter which aliases TagResolverInterface to the new MostRecentTagForCurrentBranchResolver service using git describe --tags --abbrev=0 command which limits the scope of tags to the most recent on the current branch. Of course, by default this option is set to false to keep backward compatibility.

Here are the results:

  1. Current (and the default) behavior CleanShot 2022-09-08 at 20 57 31

  2. The behavior after setting limit_recent_tag_resolving_scope_to_current_branch to true CleanShot 2022-09-08 at 20 58 11

On the second screen we can see I'm on main branch which has the latest tag 2.0.2 and after checking out to 5.x branch I get 5.0.0. Previously on every branch I was getting 5.0.0 :).

jakubtobiasz avatar Sep 08 '22 18:09 jakubtobiasz