#!/bin/sh set -eu if [ "$#" -ne 2 ]; then printf '%s\n' 'usage: ./scripts/release MODULE VERSION' >&2 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" \ gitea.maximumdirect.net/eric/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"