milandjukic88
milandjukic88

Reputation: 1125

Build and Publish azure pipeine using gitversion - version collision

I have a problem, of course. I lost 4 days trying to make it work but without success. What I want is, using gitversion task, to build and publish main and develop branches to artifact feed. For example, I want to start from version 0.1.0. When PR is made on develop branch I want to increase minor part, and to append some tag (for example alpha) and publish nuget to artifact feed. Than, when I create PR to merge develop to main (prod) I want major version to increase by 1 and to publish to feed. After that, 1.0.0 will be new base version for develop branch and every other merge to develop will be 1.1.0, 1.1.0-alpha (something like that). How this can be done?

I've used every exmple from internet, but problem is that main and develop are increased independetly. For example main is 1.0.0, than 2 commits to develop will produce (1.1.0-alpha1, 1.1.0-alpha2), and when I merge dev to main I got 1.0.0+1.

I hope you understand problem

On the gitversion website I found some Octopus Deploy. I saw there some script that maybe answer to my question. I'm not sure. What you think?

Upvotes: 0

Views: 42

Answers (1)

Alberto Maghini
Alberto Maghini

Reputation: 84

The point here is not related to how gitversion works but how your code lands on the 2 different branches. Suppose you have your featureA branch that merges into develop. This will change the history of the develop branch (because of the merge operation) and will cause gitversion to calculate a new version (e.g. 1.1.0-alpha-1).

When your featureA branch will land on main (or maybe your develop branch will land on main), the same flow will happen to lead to a new history to be created and, for sure, a new version to be calculated.

Ideally, all the development branches would have their own separate versioning based on the kind of updates (a fix, a new feature, or a breaking change). In the end, the main branch will have the real version calculated based on the sum of all the development branches that landed there.

Upvotes: 0

Related Questions