2018-11-02 12:16:29 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#####################################################################
|
|
|
|
#
|
|
|
|
# Save the timestamp-based build number for builds
|
|
|
|
# that get uploaded to places like:
|
|
|
|
# Apple Store, Play Store, or TestFlight
|
|
|
|
#
|
2019-08-23 17:16:08 +00:00
|
|
|
# The result of this script is used by scripts/version/build_no.sh
|
2018-11-02 12:16:29 +00:00
|
|
|
# when being run in Jenkins build context.
|
|
|
|
#
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
|
# Fail on first error
|
|
|
|
set -e
|
|
|
|
|
2019-06-04 17:00:19 +00:00
|
|
|
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
2018-11-02 12:16:29 +00:00
|
|
|
BUILD_NUMBER_FILE="${GIT_ROOT}/BUILD_NUMBER"
|
|
|
|
|
|
|
|
if [[ -f "${BUILD_NUMBER_FILE}" ]]; then
|
|
|
|
cat "${BUILD_NUMBER_FILE}"
|
|
|
|
else
|
2018-11-27 10:15:33 +00:00
|
|
|
# Format: Year(4 digit) + Month + Day + Hour
|
|
|
|
# Example: 2018120118
|
|
|
|
# We limited precision to hours to avoid of mismatched numbers.
|
2020-01-23 13:34:21 +00:00
|
|
|
date '+%Y%m%d%H%M%S' | tee "${BUILD_NUMBER_FILE}"
|
2018-11-02 12:16:29 +00:00
|
|
|
fi
|