Centralize release tool invocation

This commit is contained in:
2026-11-03 15:45:15 +00:00
parent 7344994198
commit b94ed6665b
3 changed files with 53 additions and 42 deletions

View File

@@ -6,44 +6,5 @@ if [ "$#" -ne 2 ]; then
exit 2
fi
case "$1" in
core)
commandkit_module_dir=.
commandkit_profile=releasekit.json
;;
ckconfig)
commandkit_module_dir=integrations/ckconfig
commandkit_profile=integrations/ckconfig/releasekit.json
;;
ckprompt)
commandkit_module_dir=integrations/ckprompt
commandkit_profile=integrations/ckprompt/releasekit.json
;;
*)
printf '%s\n' 'usage: ./scripts/release MODULE VERSION' >&2
exit 2
;;
esac
release_version=$2
commandkit_root=$(CDPATH= cd "$(dirname "$0")/.." && pwd)
CDPATH= cd "$commandkit_root"
mkdir -p "$commandkit_root/.releasekit/bin"
commandkit_host_os=$(GOWORK=off GOTOOLCHAIN=local go env GOHOSTOS)
commandkit_host_arch=$(GOWORK=off GOTOOLCHAIN=local go env GOHOSTARCH)
GOOS="$commandkit_host_os" \
GOARCH="$commandkit_host_arch" \
GOWORK=off \
GOTOOLCHAIN=local \
go build \
-mod=readonly \
-o "$commandkit_root/.releasekit/bin/releasekit" \
go.maximumdirect.net/releasekit/cmd/releasekit
GOWORK=off GOTOOLCHAIN=local exec "$commandkit_root/.releasekit/bin/releasekit" publish \
--repo "$commandkit_root" \
--config "$commandkit_root/$commandkit_profile" \
--expected-module "$commandkit_module_dir" \
"$release_version"
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
exec "$script_dir/releasekit" "$1" publish "$2"