ci/build.sh: Use commit date rather than build date in version strings of CI builds

This commit is contained in:
Kamil Śliwak 2021-01-14 15:16:08 +01:00
parent 110e0e1f25
commit a901f78be7

View File

@ -5,10 +5,20 @@ ROOTDIR="$(dirname "$0")/../.."
cd "${ROOTDIR}"
# shellcheck disable=SC2166
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]; then echo -n >prerelease.txt; fi
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]
then
echo -n "" >prerelease.txt
else
# Use last commit date rather than build date to avoid ending up with builds for
# different platforms having different version strings (and therefore producing different bytecode)
# if the CI is triggered just before midnight.
last_commit_timestamp=$(git log -1 --date=iso --format=%ad HEAD)
date -d "$last_commit_timestamp" -u "+ci.%Y.%-m.%-d" >prerelease.txt
fi
if [ -n "$CIRCLE_SHA1" ]
then
echo -n "$CIRCLE_SHA1" >commit_hash.txt
echo -n "$CIRCLE_SHA1" >commit_hash.txt
fi
mkdir -p build