feat(deploy): Vm clean, edit auf VM gelöscht
This commit is contained in:
@@ -1,25 +1,48 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
# test XDG_RUNTIME_DIR
|
# test XDG_RUNTIME_DIR
|
||||||
|
|
||||||
|
LOGFILE="/var/log/bruchtal-deploy.log"
|
||||||
cd /workspace
|
cd /workspace
|
||||||
|
|
||||||
echo "==> Pulling latest changes"
|
log() {
|
||||||
git pull
|
echo "$(date '+%Y-%m-%d %H:%M:%S') | $*" | tee -a "$LOGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
echo "==> Checking for new or modified Markdown files"
|
# -----------------------------
|
||||||
# A = Added, M = Modified
|
# 1️⃣ VM-Repo sauber halten
|
||||||
changed=$(git diff --name-status HEAD~1 HEAD | grep -E '^[AM]\s.*(\.md$|mkdocs\.yml$)' | awk '{print $2}' || true)
|
# -----------------------------
|
||||||
|
log "Checking for local changes on VM..."
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
if [ -n "$changed" ]; then
|
log "⚠️ Warning: Local changes on VM will be lost!"
|
||||||
echo "Markdown changes detected:"
|
git reset --hard
|
||||||
echo "$changed"
|
git clean -fd
|
||||||
echo "==> Restarting bruchtal-docs container"
|
log "Local changes discarded."
|
||||||
cd /workspace
|
|
||||||
docker restart bruchtal-docs
|
|
||||||
else
|
else
|
||||||
echo "No Markdown changes detected. Skipping restart."
|
log "VM repo is clean, no local changes to discard."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> Deploy finished"
|
# -----------------------------
|
||||||
|
# 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."
|
||||||
25
deploy/deploy-bruchtal.sh-sik
Executable file
25
deploy/deploy-bruchtal.sh-sik
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
# test XDG_RUNTIME_DIR
|
||||||
|
|
||||||
|
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"
|
||||||
6
docs/workflows/repo-reparieren.md
Normal file
6
docs/workflows/repo-reparieren.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Reparieren des Gitea-Repos
|
||||||
|
## Ausgangslage: aus Versehen Datei auf Vm editier anstatt in VS Code
|
||||||
|
Problem: das Repo ist auseiander gelaufen.
|
||||||
|
##Lösungsansatz:
|
||||||
|
- **Wichtig:** dafür sorgen, dass die "korrekten" Dateien auf dem PC liegen wo VS läuft
|
||||||
|
-
|
||||||
Reference in New Issue
Block a user