Given: Bitbucket repo, and 2 developers, Steve and Bob who are working on 2 branches, feature/alpha & feature/beta. On master branch and feature branches we have a properties file with version - let say 8.3.0.
How to... ensure that after Bob or Steve merges their pull request to the master the patch version on the master is incremented? I.e.:
- Steve finishes his feature/alpha first, his pull request is approved and while he merges it to master the version on master becomes 8.3.1. After Bob does the same - 8.3.2.
Looking for the less painful solution. Thx in advance!
UPDATE 2020-12-07:
mnestorov's answer with some modifications led to the desired result. The difference was that I had no rights to add pre-merge hooks on the server. In case someone is strugling with the same issue - here is a hackish recepie:
- create a pre-push hook and put incrementation logic there.
- use one of existing maven plugins for git hooks and make the created hook a part of your repo.
In this way you will ensure your incrementation script will run any time your teammates push without begging devops for help :)