735c1eb30e
- .gitea/workflows/lint.yml: new workflow running shellcheck on .sh files
and eslint on hookshot/ JS transform scripts
- hookshot/.eslintrc.json: declare data/result as hookshot globals
- hookshot/ci-alert.js: new Matrix hookshot transform for CI failure alerts
- hookshot/deploy.sh: fix SC2155 (split local/assign), SC2034 (remove unused var)
- systemd/livekit-clear-port.sh: fix SC2148 (invalid shebang escape)
- cinny/dev-update.sh: fix SC2115 (use ${WEB_ROOT:?} to guard rm -rf)
- deploy/lxc151-hookshot.sh: add shellcheck source=/dev/null for sourced file
- .gitignore: ignore node_modules/
- package.json + package-lock.json: eslint@8 dev dependency
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
1.6 KiB
Bash
51 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# Auto-deploy script for LXC 151 (matrix homeserver)
|
|
# Handles: hookshot transformation functions, livekit service file (graceful)
|
|
# Triggered by: Gitea webhook on push to main
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="/opt/matrix-config"
|
|
LOG="/var/log/matrix-deploy.log"
|
|
CLONE_URL="https://code.lotusguild.org/LotusGuild/matrix.git"
|
|
ENV_FILE="/etc/matrix-deploy.env"
|
|
|
|
exec >> "$LOG" 2>&1
|
|
echo "=== $(date) === LXC151 deploy triggered ==="
|
|
|
|
# Load env (MATRIX_TOKEN, MATRIX_SERVER, MATRIX_ROOM)
|
|
if [ -f "$ENV_FILE" ]; then
|
|
# shellcheck source=/dev/null
|
|
source "$ENV_FILE"
|
|
fi
|
|
|
|
# Clone or pull
|
|
if [ ! -d "$REPO_DIR/.git" ]; then
|
|
git clone "$CLONE_URL" "$REPO_DIR"
|
|
else
|
|
cd "$REPO_DIR"
|
|
git fetch --all
|
|
PREV=$(git rev-parse HEAD)
|
|
git reset --hard origin/main
|
|
NEW=$(git rev-parse HEAD)
|
|
CHANGED=$(git diff --name-only "$PREV" "$NEW")
|
|
echo "Changed files: $CHANGED"
|
|
|
|
# Hookshot transforms
|
|
if echo "$CHANGED" | grep -q '^hookshot/'; then
|
|
echo "Deploying hookshot transforms..."
|
|
export MATRIX_TOKEN MATRIX_SERVER MATRIX_ROOM
|
|
bash "$REPO_DIR/hookshot/deploy.sh"
|
|
fi
|
|
|
|
# Livekit service file — graceful restart (never kill active calls)
|
|
if echo "$CHANGED" | grep -q '^systemd/livekit-server.service'; then
|
|
echo "livekit-server.service changed — staging graceful restart..."
|
|
cp "$REPO_DIR/systemd/livekit-server.service" /etc/systemd/system/livekit-server.service
|
|
systemctl daemon-reload
|
|
touch /run/livekit-restart-pending
|
|
echo "Restart pending — will apply when no active calls."
|
|
fi
|
|
fi
|
|
|
|
echo "=== $(date) === LXC151 deploy complete ==="
|