#!/bin/sh

# the following is to be run from _build directory
if [ -d ../.git ] && which git >/dev/null 2>&1; then
    BUILD=${BUILD:-$(git describe)}
else
    BUILD=${BUILD:-$(date -u +%Y%m%d)}
fi

head -n1 VERSION
echo $BUILD

#!/bin/sh

# the following is to be run from _build directory
if [ -d ../.git ] && which git >/dev/null 2>&1; then
    BUILD=${BUILD:-$(git describe)}
else
    DATE=${SOURCE_DATE_EPOCH:-$(date +%s)}
    DATE=$(date -d @$DATE +%Y%m%d)
    BUILD=${BUILD:-$DATE}
fi

head -n1 VERSION
echo $BUILD

Use SOURCE_DATE_EPOCH if defined for reproducible builds
Use SOURCE_DATE_EPOCH if defined for reproducible builds

See https://reproducible-builds.org/specs/source-date-epoch/
