2022-06-02 21:26:42 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -o pipefail -o errexit
|
2023-02-15 23:50:55 +03:00
|
|
|
BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
|
2022-06-02 21:26:42 +03:00
|
|
|
|
|
|
|
# Error handling
|
|
|
|
handle_error() {
|
|
|
|
read -n1 -r -p "FAILED: line $1, exit code $2. Press any key to exit..." _
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
trap 'handle_error $LINENO $?' ERR
|
|
|
|
|
|
|
|
# Load default script environment variables
|
|
|
|
# shellcheck source=.script_env
|
|
|
|
. "${BASEDIR}/.script_env"
|
|
|
|
|
|
|
|
# Show used versions
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
|
|
|
|
# Build
|
2022-06-29 16:49:38 +03:00
|
|
|
pushd "${VAULT_FOLDER}"
|
2022-06-02 21:26:42 +03:00
|
|
|
npm ci
|
2022-06-29 16:49:38 +03:00
|
|
|
|
|
|
|
pushd apps/web
|
2022-06-02 21:26:42 +03:00
|
|
|
npm run dist:oss:selfhost
|
|
|
|
|
|
|
|
# Delete debugging map files, optional
|
|
|
|
#find build -name "*.map" -delete
|
|
|
|
|
|
|
|
# Create vw-version.json with the latest tag from the remote repo.
|
|
|
|
printf '{"version":"%s"}' \
|
2023-05-11 22:26:07 +03:00
|
|
|
"$(git -c 'versionsort.suffix=-' ls-remote --tags --refs --sort='v:refname' https://github.com/dani-garcia/bw_web_builds.git 'v*' | tail -n1 | grep -Eo '[^\/v]*$')" \
|
2022-06-02 21:26:42 +03:00
|
|
|
> build/vw-version.json
|
|
|
|
|
|
|
|
popd
|
2022-06-29 16:49:38 +03:00
|
|
|
popd
|