Merge pull request #10771 from ethereum/use-commit-date-in-ci-builds

Commit date in CI build version strings
This commit is contained in:
chriseth 2021-01-14 18:38:45 +01:00 committed by GitHub
commit f9bfceccd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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