Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
24 lines
742 B
Bash
Executable File
24 lines
742 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
|
BACKEND_DIR="$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)"
|
|
REPO_DIR="$(CDPATH= cd -- "$BACKEND_DIR/.." && pwd)"
|
|
VERSION_FILE="$BACKEND_DIR/cmd/server/VERSION"
|
|
|
|
# Prefer the exact release tag when building from a tagged checkout so
|
|
# source builds from vX.Y.Z don't inherit the previous VERSION file value.
|
|
if command -v git >/dev/null 2>&1; then
|
|
TAG="$(
|
|
git -C "$REPO_DIR" describe --tags --exact-match --match 'v[0-9]*' 2>/dev/null || \
|
|
git -C "$REPO_DIR" describe --tags --exact-match --match '[0-9]*' 2>/dev/null || \
|
|
true
|
|
)"
|
|
if [ -n "$TAG" ]; then
|
|
printf '%s\n' "${TAG#v}"
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
printf '%s\n' "$(tr -d '\r\n' < "$VERSION_FILE")"
|