darkmoon_uk
12/17/2021, 1:02 PMscp
. A crude solution maybe, but simple, in fact so simple that if it ever got out of step it'd be very easy to fix (just edit the number in the file manually).
Even Fastlane doesn't really solve this problem, it has an increment plugin but this only increments 'once' unless you also commit the value back to the repo: and a CI runner committing changes seems very undesirable to me for several reasons.
Using branch build count could work nicely but the CI I'm using (GitLab) doesn't track this.Jurriaan Mous
12/17/2021, 1:22 PMjames
12/21/2021, 5:42 AMgit rev-list --count HEAD
this gives us the total count of commits on the current branch, and we have configured our build script to use that count as the versionCode
this way there is no incrementing/writing/updating any file or counter somewhere, since it’s just based on the repo itself
if our repo ever changes dramatically (ie. lost history, or repo split/merge or something) we can simply add a million or so to the count
inside the build script and continue on our way