feat(webhook): scripts

This commit is contained in:
2026-03-05 19:18:26 +01:00
parent be3601b39d
commit 81d8f89552
6 changed files with 23 additions and 4 deletions

View File

@@ -0,0 +1,48 @@
#!/bin/sh
set -e
# test XDG_RUNTIME_DIR
LOGFILE="/var/log/bruchtal-deploy.log"
cd /workspace
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') | $*" | tee -a "$LOGFILE"
}
# -----------------------------
# 1⃣ VM-Repo sauber halten
# -----------------------------
log "Checking for local changes on VM..."
if [ -n "$(git status --porcelain)" ]; then
log "⚠️ Warning: Local changes on VM will be lost!"
git reset --hard
git clean -fd
log "Local changes discarded."
else
log "VM repo is clean, no local changes to discard."
fi
# -----------------------------
# 2⃣ Pull latest changes
# -----------------------------
log "Pulling latest changes from Gitea"
git pull
# -----------------------------
# 3⃣ Check for Markdown changes
# -----------------------------
log "Checking for new or modified Markdown files..."
changed=$(git diff --name-status HEAD~1 HEAD | grep -E '^[AM]\s.*(\.md$|mkdocs\.yml$)' | awk '{print $2}' || true)
if [ -n "$changed" ]; then
log "Markdown changes detected:"
for f in $changed; do
log " - $f"
done
log "Restarting bruchtal-docs container..."
docker restart bruchtal-docs
else
log "No Markdown changes detected. Skipping restart."
fi
log "Deploy finished."

View File

@@ -0,0 +1,25 @@
#!/bin/sh
set -e
# test XDG_RUNTIME_DIR
#HALLO
cd /workspace
echo "==> Pulling latest changes"
git pull
echo "==> Checking for new or modified Markdown files"
# A = Added, M = Modified
changed=$(git diff --name-status HEAD~1 HEAD | grep -E '^[AM]\s.*(\.md$|mkdocs\.yml$)' | awk '{print $2}' || true)
if [ -n "$changed" ]; then
echo "Markdown changes detected:"
echo "$changed"
echo "==> Restarting bruchtal-docs container"
cd /workspace
docker restart bruchtal-docs
else
echo "No Markdown changes detected. Skipping restart."
fi
echo "==> Deploy finished"

View File

@@ -0,0 +1,7 @@
[
{
"id": "bruchtal-deploy",
"execute-command": "/workspace/deploy/deploy-bruchtal.sh",
"command-working-directory": "/workspace"
}
]