Files
narratio/scripts/release-lib.sh

27 lines
575 B
Bash
Raw Normal View History

2026-08-30 19:10:26 +00:00
#!/bin/sh
# Shared helpers for Narratio's checked-in release scripts. This file is
# intentionally source-only and has no effect when loaded.
narratio_release_fail() {
tool_name=$1
shift
printf '%s: %s\n' "$tool_name" "$*" >&2
exit 1
}
narratio_release_validate_version() {
2026-08-30 20:36:23 +00:00
case $1 in
*'
'*) return 1 ;;
2026-08-30 19:10:26 +00:00
esac
2026-08-30 20:36:23 +00:00
printf '%s\n' "$1" |
grep -Eq '^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
2026-08-30 19:10:26 +00:00
}
narratio_release_repo_root() (
script_path=$1
script_dir=$(CDPATH= cd "$(dirname "$script_path")" && pwd -P) || return 1
CDPATH= cd "$script_dir/.." && pwd -P
)