Reputation: 9863
When it comes to generate versions using conventional commits from a repo that contains only one python package things are easy, you just need to use one tool that loops through all the repo commits and compute the version by parsing these conventional commits (break-change=major, feat=minor, fix=patch), so far so good.
What happens in a monorepo that contain multiple products that needs to track different versions? Let me put you an example, the azure sdk for python for instance, how would you use conventional commits & tooling effectively for this type of repos?
I'd like to come up with a solution that obviously scales up, for instance, it'd be able to automatically compute the version of the different monorepo products at the pipeline level without any developers interaction. Some of the points I'm trying to clarify here would be:
But anyway, my question is simple, is there any best practice to follow for this one?
Upvotes: 2
Views: 937
Reputation: 2076
Here is an example of how we do it with Reliza Hub (out tool): https://github.com/relizaio/rebom/blob/master/.github/workflows/github_actions.yml
Idea:
difflines=$(git diff $last_commit..$GITHUB_SHA ./ | wc -l)
if [ "$difflines" != "0" ]
then
dobuild=true
fi
There may be other tools that do that but the key point is you need some external storage that would keep track of successful builds mapped to corresponding commits. Some people also try to overload git tags to achieve that - but this rarely works for monorepos.
Upvotes: 1