We are using Gitlab for our VCS and pushing code to App Center; Gitlab-ci.yml will only perform security checks and run unit tests on shared runners then App Center would pickup the builds where it will build and deploy both iOS and Android apps to it's respective branches and then to Prod eventually. I am tasked with automating the App Version numbers (maj.min.pat.build) with following rules:
- When merging into qa from develop, bump the minor version of develop by 1 and reset the patch version to 0.
- Branches should increment their own build number based on number of commits.
- When merging from feature/* branches into develop, increment develop by the number of commits.
- When merging into master from hotfix/*, bump the patch version by 1.
- This versioning method should be Branch Agnostic and cannot be hard coded.
What i am trying to understand is how would Gitlab know that Develop branch is being merged into QA or when feature/* branch merges into develop and then bumps up the version numbers for both iOS and Android apps? Because all the code merges take place in Gitlab and App Center only builds what its configured to build. So I need to come up with the a method where version bumps happen prior to the apps building in App Center. I've searched Gitlab docs but doesn't say anything about build increments. Is this even possible with Gitlab? Is there some Gitlab functionality that would automate this process?
I came up with an appcenter-post-clone-pre-build-script with the help of Fastlane that would bump the maj.min.pat versions based on the branch. Which is not the correct way after I went back and read the requirements.
I am stumped and continuing to search for an answer. Any help would be appreciated.
Thanks in advance, Jamal.