#!/usr/bin/env bash ##################################################################### # # This script manages app build numbers. # It returns the next build number to be used. # The limit of size of the number is signed int, which is 2147483647. # # These numbers are used to mark app artifacts for: # * Play Store - versionCode attribute (gradle) # * Apple Store - CFBundleVersion attribute (plutil) # # For more details see: # * https://developer.android.com/studio/publish/versioning # * https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # # History: # # This script used to tag builds with `build-[0-9]+` tags. # Since only release builds actually get uploaded to Play or Apple # stores only then is the uniqueness of numbers checked. # Because of that we are fine using just hour granurality. # ##################################################################### # Fail on first error set -e GIT_ROOT=$(git rev-parse --show-toplevel) DEV_BUILD_NUMBER=9999 BUILD_NUMBER_FILE="${GIT_ROOT}/BUILD_NUMBER" # If running under Jenkins use a timestamp-based build number. # That build number is generated by the scripts/gen_build_no.sh script. if [[ -f "${BUILD_NUMBER_FILE}" ]]; then cat "${BUILD_NUMBER_FILE}" else echo "${DEV_BUILD_NUMBER}" fi