2020-03-10 09:57:52 +08:00
|
|
|
#!/bin/sh
|
2019-12-03 07:58:50 +08:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2019-12-25 09:34:40 +08:00
|
|
|
TAG=$(git describe --tags)
|
2019-12-03 07:58:50 +08:00
|
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
DIST_VERSION=$TAG
|
|
|
|
|
|
|
|
# If the branch comes out as HEAD then we're probably checked out to a tag, so if the thing is *not*
|
|
|
|
# coming out as HEAD then we're on a branch. When we're on a branch, we want to resolve ourselves to
|
|
|
|
# a few SHAs rather than a version.
|
2019-12-25 09:34:40 +08:00
|
|
|
# Docker Hub doesn't always check out the tag and sometimes checks out the branch, so we should look
|
|
|
|
# for an appropriately tagged branch as well (heads/v1.2.3).
|
2020-03-20 05:00:36 +08:00
|
|
|
if [[ $BRANCH != HEAD && ! $BRANCH =~ heads/v.+ ]]
|
2019-12-03 07:58:50 +08:00
|
|
|
then
|
2021-12-07 12:11:01 +08:00
|
|
|
DIST_VERSION=`$(dirname $0)/get-version-from-git.sh`
|
2019-12-03 07:58:50 +08:00
|
|
|
fi
|
|
|
|
|
2021-12-07 12:11:01 +08:00
|
|
|
DIST_VERSION=`$(dirname $0)/normalize-version.sh ${DIST_VERSION}`
|
|
|
|
VERSION=$DIST_VERSION yarn build
|
2019-12-03 07:58:50 +08:00
|
|
|
echo $DIST_VERSION > /src/webapp/version
|