2022-07-29 16:30:16 +03:00
|
|
|
#!/bin/bash
|
2019-12-03 02:58:50 +03:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
2022-07-29 16:30:16 +03:00
|
|
|
DIST_VERSION=$(git describe --abbrev=0 --tags)
|
2019-12-03 02:58:50 +03:00
|
|
|
|
2022-07-29 16:30:16 +03:00
|
|
|
DIR=$(dirname "$0")
|
|
|
|
|
2022-09-05 11:35:16 +03:00
|
|
|
# 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.
|
|
|
|
if [[ $BRANCH != HEAD && ! $BRANCH =~ heads/v.+ ]]
|
2019-12-03 02:58:50 +03:00
|
|
|
then
|
2022-07-29 16:30:16 +03:00
|
|
|
DIST_VERSION=$("$DIR"/get-version-from-git.sh)
|
2019-12-03 02:58:50 +03:00
|
|
|
fi
|
|
|
|
|
2022-07-29 16:30:16 +03:00
|
|
|
DIST_VERSION=$("$DIR"/normalize-version.sh "$DIST_VERSION")
|
2021-12-07 07:11:01 +03:00
|
|
|
VERSION=$DIST_VERSION yarn build
|
2022-07-29 16:30:16 +03:00
|
|
|
echo "$DIST_VERSION" > /src/webapp/version
|