Centralize release tool invocation
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Release tooling implementation plan
|
# Release tooling implementation plan
|
||||||
|
|
||||||
Status: Stage 1 complete; Stages 2–6 pending.
|
Status: Stages 1–2 complete; Stages 3–6 pending.
|
||||||
|
|
||||||
Follow the stages in integer order. This is one end-to-end sprint: intermediate
|
Follow the stages in integer order. This is one end-to-end sprint: intermediate
|
||||||
stages may temporarily leave scripts, tests, and documentation inconsistent.
|
stages may temporarily leave scripts, tests, and documentation inconsistent.
|
||||||
@@ -80,6 +80,10 @@ entirely by the existing upstream profile schema.
|
|||||||
|
|
||||||
## Stage 2: Centralize tool invocation and module routing
|
## Stage 2: Centralize tool invocation and module routing
|
||||||
|
|
||||||
|
**Completed.** Both scripts pass shell syntax checks; a fake Go invocation
|
||||||
|
confirmed representative publication and raw-command forwarding. Focused
|
||||||
|
coverage follows in Stage 3.
|
||||||
|
|
||||||
Create executable POSIX-shell `scripts/releasekit` as the shared entry point.
|
Create executable POSIX-shell `scripts/releasekit` as the shared entry point.
|
||||||
Keep executable `scripts/release` as the existing publication convenience entry
|
Keep executable `scripts/release` as the existing publication convenience entry
|
||||||
point. No shell library, module-map file, generated script, or JSON parser is
|
point. No shell library, module-map file, generated script, or JSON parser is
|
||||||
|
|||||||
@@ -6,44 +6,5 @@ if [ "$#" -ne 2 ]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
|
||||||
core)
|
exec "$script_dir/releasekit" "$1" publish "$2"
|
||||||
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"
|
|
||||||
|
|||||||
46
scripts/releasekit
Executable file
46
scripts/releasekit
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
printf '%s\n' 'usage: releasekit MODULE {publish|check|deliver} [ARGS...] | releasekit {version|publication-attempts|reconcile} [ARGS...]' >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$#" -ge 1 ] || usage
|
||||||
|
case "$1" in
|
||||||
|
core) module_dir=.; profile=releasekit.json ;;
|
||||||
|
ckconfig) module_dir=integrations/ckconfig; profile=integrations/ckconfig/releasekit.json ;;
|
||||||
|
ckprompt) module_dir=integrations/ckprompt; profile=integrations/ckprompt/releasekit.json ;;
|
||||||
|
version|publication-attempts|reconcile) module_dir= ;;
|
||||||
|
*) usage ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$module_dir" ]; then
|
||||||
|
shift
|
||||||
|
[ "$#" -ge 1 ] || usage
|
||||||
|
operation=$1
|
||||||
|
shift
|
||||||
|
case "$operation" in
|
||||||
|
publish|check|deliver) ;;
|
||||||
|
*) usage ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
root=$(CDPATH= cd "$(dirname "$0")/.." && pwd)
|
||||||
|
CDPATH= cd "$root"
|
||||||
|
GOWORK=off
|
||||||
|
GOTOOLCHAIN=local
|
||||||
|
export GOWORK GOTOOLCHAIN
|
||||||
|
GOOS=$(go env GOHOSTOS)
|
||||||
|
GOARCH=$(go env GOHOSTARCH)
|
||||||
|
GOFLAGS="$(go env GOFLAGS) -mod=readonly"
|
||||||
|
export GOOS GOARCH GOFLAGS
|
||||||
|
|
||||||
|
if [ -n "$module_dir" ]; then
|
||||||
|
if [ "$operation" = publish ]; then
|
||||||
|
set -- "$operation" --repo "$root" --config "$root/$profile" --expected-module "$module_dir" "$@"
|
||||||
|
else
|
||||||
|
set -- "$operation" --repo "$root" --config "$root/$profile" "$@"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
exec go tool go.maximumdirect.net/releasekit/cmd/releasekit "$@"
|
||||||
Reference in New Issue
Block a user