From 45231fef9002db72882a4c11ba07fbb98b9ee659 Mon Sep 17 00:00:00 2001 From: shuki Date: Sat, 7 Mar 2026 07:08:21 +0200 Subject: [PATCH] Add deploy script --- scripts/deploy.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 scripts/deploy.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..4b4595f --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Deploy gniza: commit, push, sync to local install, restart web service +set -e + +cd "$(dirname "$0")/.." + +# Commit and push +if [[ -n "$(git status --porcelain)" ]]; then + git add -A + msg="${1:-Deploy update}" + git commit -m "$msg" +fi +git push + +# Sync to local install +INSTALL_DIR="${HOME}/.local/share/gniza" +if [[ -d "$INSTALL_DIR" ]]; then + cp bin/gniza "$INSTALL_DIR/bin/gniza" + cp -r lib/* "$INSTALL_DIR/lib/" + cp -r tui/* "$INSTALL_DIR/tui/" + echo "Synced to $INSTALL_DIR" +fi + +# Restart web service +if systemctl --user is-active gniza-web.service &>/dev/null; then + systemctl --user restart gniza-web.service + echo "Web service restarted" +fi + +echo "Done"