Add release asset builder

This commit is contained in:
2026-08-30 19:10:26 +00:00
parent c812fe3655
commit 23dc4e2078
4 changed files with 307 additions and 1 deletions

46
scripts/release-lib.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/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() {
version=$1
case $version in
v*.*.*) ;;
*) return 1 ;;
esac
components=${version#v}
if [ "$components" = "$version" ]; then
return 1
fi
previous_ifs=$IFS
IFS=.
set -- $components
IFS=$previous_ifs
if [ "$#" -ne 3 ]; then
return 1
fi
for component in "$@"; do
case $component in
0 | [1-9]*) ;;
*) return 1 ;;
esac
case $component in
*[!0-9]*) return 1 ;;
esac
done
}
narratio_release_repo_root() (
script_path=$1
script_dir=$(CDPATH= cd "$(dirname "$script_path")" && pwd -P) || return 1
CDPATH= cd "$script_dir/.." && pwd -P
)