Hello there, I have a script for custom build numbers, but this could be easily be rewritten to this purpose as well I think
make sure to add $BITRISE_SOURCE_DIR/magicnum.txt
to the cache push step
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
if [ ! -f $BITRISE_SOURCE_DIR/magicnum.txt ]
then
touch $BITRISE_SOURCE_DIR/magicnum.txt
fi
inc=$(<$BITRISE_SOURCE_DIR/magicnum.txt)
if [ -z "$inc" ]
then
echo 1000 > $BITRISE_SOURCE_DIR/magicnum.txt
inc=$(<$BITRISE_SOURCE_DIR/magicnum.txt)
fi
if [ $BITRISE_TRIGGERED_WORKFLOW_TITLE == "test" ]
then
build_number_offset=1
envman add --key MY_BUILD_NUMBER --value $((build_number_offset + inc))
echo $(( inc + 1 )) > ./magicnum.txt
fi