Files
ObjectStore/client/scripts/version.sh
T
admin d73fa2c435
ObjectStore CI / build (push) Successful in 10m22s
Add shared cluster credentials and readiness CI
2026-11-16 03:41:32 +01:00

20 lines
650 B
Bash

#!/usr/bin/env bash
set -euo pipefail
if (( $# > 1 )); then
echo "usage: version.sh [VERSION]" >&2
exit 1
fi
version_file="$(dirname "$0")/../../src/cloud/lunarsky/store/Version.java"
version="$(sed -nE 's/^[[:space:]]*static final String VALUE = "([^"]+)";[[:space:]]*$/\1/p' "$version_file")"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][A-Za-z0-9]+)*$ ]]; then
echo "Cannot determine the source version from Version.java" >&2
exit 1
fi
if [[ -n "${1:-}" && "$1" != "$version" ]]; then
echo "Requested version $1 does not match source version $version; build from the matching source tag" >&2
exit 1
fi
printf '%s\n' "$version"