prepare for release!

This commit was merged in pull request #8.
This commit is contained in:
lda
2026-04-14 06:56:08 +07:00 Unverified
parent c28b62ef67
commit 37c0b67a96
14 changed files with 345 additions and 13 deletions
+87
View File
@@ -0,0 +1,87 @@
#!/usr/bin/env sh
# Package wakey-control-plane bundle (binary + UI dist + updater + systemd template).
# Archive paths are relative so extraction can target any install directory.
#
# Usage:
# ./scripts/package_wakey_cc_bundle.sh --version v0.1.0 --target x86_64-unknown-linux-gnu
#
# Optional:
# --out-dir dist
# --binary target/<target>/release/wakey-control-plane
# --ui-dist ui/dist
set -eu
VERSION=""
TARGET=""
OUT_DIR="dist"
BINARY=""
UI_DIST="ui/dist"
while [ "$#" -gt 0 ]; do
case "$1" in
--version)
VERSION="$2"
shift 2
;;
--target)
TARGET="$2"
shift 2
;;
--out-dir)
OUT_DIR="$2"
shift 2
;;
--binary)
BINARY="$2"
shift 2
;;
--ui-dist)
UI_DIST="$2"
shift 2
;;
*)
echo "unknown arg: $1" >&2
exit 1
;;
esac
done
[ -n "$VERSION" ] || { echo "--version is required" >&2; exit 1; }
[ -n "$TARGET" ] || { echo "--target is required" >&2; exit 1; }
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
cd "$ROOT_DIR"
if [ -z "$BINARY" ]; then
BINARY="target/$TARGET/release/wakey-control-plane"
fi
[ -f "$BINARY" ] || { echo "missing binary: $BINARY" >&2; exit 1; }
[ -f "$UI_DIST/index.html" ] || { echo "missing UI dist index: $UI_DIST/index.html" >&2; exit 1; }
[ -f "scripts/update_wakey_cc.sh" ] || { echo "missing updater script" >&2; exit 1; }
[ -f "deploy/systemd/wakey-cc.service" ] || { echo "missing systemd template" >&2; exit 1; }
mkdir -p "$OUT_DIR"
STAGING="$OUT_DIR/wakey-cc-stage.$$"
PKG="wakey-cc-$VERSION-$TARGET.tgz"
rm -rf "$STAGING"
mkdir -p "$STAGING/bin" "$STAGING/ui" "$STAGING/scripts" "$STAGING/deploy/systemd"
cp "$BINARY" "$STAGING/bin/wakey-control-plane"
cp -a "$UI_DIST" "$STAGING/ui/dist"
cp "scripts/update_wakey_cc.sh" "$STAGING/scripts/update_wakey_cc.sh"
cp "deploy/systemd/wakey-cc.service" "$STAGING/deploy/systemd/wakey-cc.service"
chmod +x "$STAGING/bin/wakey-control-plane" "$STAGING/scripts/update_wakey_cc.sh"
(
cd "$STAGING"
tar -czf "$ROOT_DIR/$OUT_DIR/$PKG" .
)
rm -rf "$STAGING"
echo "Bundle package: $OUT_DIR/$PKG"
echo "Contains: bin/wakey-control-plane, ui/dist, scripts/update_wakey_cc.sh, deploy/systemd/wakey-cc.service"