I found this link https://stackguides.com/questions/6579697/android-how-to-make-the-versioncode-update-automatically-with-every-build that contains the following code:
#!/usr/bin/env bash
MANIFEST="AndroidManifest.xml"
if [ -f $MANIFEST ]
then
LINE=$(grep -o ${MANIFEST} -e 'android:versionCode="[0-9]*"');
declare -a LINE;
LINE=(`echo $LINE | tr "\"" " "`);
VERSION=(${LINE[1]});
INCREMENTED=$(($VERSION+1))
sed "s/android:versionCode=\"[0-9]*\"/android:versionCode=\"${INCREMENTED}\"/" $MANIFEST > $MANIFEST.tmp && mv $MANIFEST.tmp $MANIFEST
git add $MANIFEST
echo "Updated android:versionCode to ${INCREMENTED} in ${MANIFEST}";
fi
I'm using a TortoiseSVN with a windows SVN server however (VisualSVN) so I'm wondering if this could be put into a cygwin command somehow so that the pre-commit hooks in svn can run this? I've not used cygwin much, but am looking for a way to have my version name update every time a commit is built.
Edit: actually it looks like you can use a tool call FARThttp://fart-it.sourceforge.net/ to find and replace text, so i may be able to write a batch script in the SVN pre-commit to find and replace the text.
Edit #2: FART would be more complicated, I'm going to try using the first script, but replace "git add" with "svn add" and see if that works