Appflow:build script to git commit - is it possible?

I would like to auto-increment the version number during build.
The expected effect is - after successive builds, the version that I see in my app somewhere is bigger every time. For Android build I use Trapeze that can autoincrement the versionCode and places it in the build.gradle file , and for Web build I use npm-version patch, that icrements the 3rd part of the version and writes the change into package.json

However it is not enough to do this all, the result should be committed and pushed back to the git repo.
The question - is it allowed? Has it been tried? Does it work ? Is it a good practice? Is there a better alternative to what I want to achieve ?

Mike

Replying to myself from a different account.
Adding ‘git status’ to the script shows that

  1. it is possible to use git to commit
  2. we have a detached HEAD, doing a checkout if a specific commit. No suprise here, should have thought about it before
  3. to commit to the same branch to preserve auto increment it seems the policy should be to always build on appflow off the same branch.

So my questions to the wise crowd still are - would you do it? if not how do you deal with versioning ? do you have automatic update of something during the build?