element-web-Github/scripts/docker-package.sh
Robin 46c005a5d3
Don't hardcode /bin/bash in scripts (#23740)
Some operating systems, such as NixOS, don't place binaries in /bin. The appropriate cross-platform method is to use /usr/bin/env.
2022-11-09 09:58:06 -05:00

21 lines
626 B
Bash
Executable File

#!/usr/bin/env bash
set -ex
BRANCH=$(git rev-parse --abbrev-ref HEAD)
DIST_VERSION=$(git describe --abbrev=0 --tags)
DIR=$(dirname "$0")
# 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.+ ]]
then
DIST_VERSION=$("$DIR"/get-version-from-git.sh)
fi
DIST_VERSION=$("$DIR"/normalize-version.sh "$DIST_VERSION")
VERSION=$DIST_VERSION yarn build
echo "$DIST_VERSION" > /src/webapp/version