2022-06-02 21:26:42 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# shellcheck disable=SC2034
|
|
|
|
set -o pipefail -o errexit
|
2024-11-05 00:20:19 +03:00
|
|
|
ENV_BASEDIR=$(RL=$(readlink -n "$0"); SP="${RL:-$0}"; dirname "$(cd "$(dirname "${SP}")"; pwd)/$(basename "${SP}")")
|
2022-06-02 21:26:42 +03:00
|
|
|
|
2024-07-11 19:21:51 +03:00
|
|
|
VAULT_FOLDER=${VAULT_FOLDER:=web-vault}
|
|
|
|
CHECKOUT_TAGS=${CHECKOUT_TAGS:=true}
|
2022-06-02 21:26:42 +03:00
|
|
|
OUTPUT_FOLDER=builds
|
|
|
|
|
|
|
|
function get_web_vault_version {
|
|
|
|
# First check if we are able to get a tag or branch
|
|
|
|
VAULT_VERSION=$(git describe --abbrev=0 --tags --exact-match 2>/dev/null || git branch --show-current)
|
|
|
|
# Else we will use the current commit hash
|
|
|
|
if [[ -z "${VAULT_VERSION}" ]]; then
|
|
|
|
VAULT_VERSION=$(git rev-parse HEAD)
|
|
|
|
fi
|
2023-12-18 19:09:47 +03:00
|
|
|
# Remove everything up to the first occurrence of "-"
|
|
|
|
# The extracted tag could start with either `web-`, `desktop-`, `cli-` or `browser-`
|
|
|
|
echo "${VAULT_VERSION#*-}"
|
2022-06-02 21:26:42 +03:00
|
|
|
}
|
2024-11-05 00:20:19 +03:00
|
|
|
|
|
|
|
# Load build environment variables if it exists
|
|
|
|
if [ -f "${ENV_BASEDIR}/../.build_env" ]; then
|
|
|
|
# shellcheck source=../.build_env
|
|
|
|
. "${ENV_BASEDIR}/../.build_env"
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset ENV_BASEDIR
|