I am leading a team of developers creating a Java library. We are following the standard Semantic Versioning model. The code is versioned with Git. Artifacts are built and pushed to an artifact server using Gradle.
As is the standard, the artifact version, when published, is determined in build.gradle
with the line version 'xxx.xxx.xxx'
. I want to enforce a policy that all merges to the master branch require that this version
be changed. This is to ensure we don't accidentally publish a new artifact over an old version, which could cause a dependency nightmare for downstream users of our library.
It looks to me like the Git Client Side Hooks may hold the answer, but the methodology for scanning through the changes in a merge and looking for a particular one eludes me.
Note that I do not need the hook to do any intelligence around the changes to the version
line. I trust the developers increment the values correctly. This is just about making sure a forgetful dev (which will undoubtedly be me) is reminded that the version
needs to be changed.