Files
narratio/scripts/release-lib.sh

27 lines
575 B
Bash
Executable File

#!/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() {
case $1 in
*'
'*) return 1 ;;
esac
printf '%s\n' "$1" |
grep -Eq '^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
}
narratio_release_repo_root() (
script_path=$1
script_dir=$(CDPATH= cd "$(dirname "$script_path")" && pwd -P) || return 1
CDPATH= cd "$script_dir/.." && pwd -P
)