Lets content edits pushed through Git reach the live admin-content volume (and vice versa) without silently overwriting whatever was changed through the admin editor UI in the meantime. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
22 lines
893 B
Bash
22 lines
893 B
Bash
#!/bin/bash
|
||
# Holt den aktuellen Live-Content (vom Admin-Editor bearbeitet) aus dem
|
||
# Server-Volume zurück nach Git, bevor Claude Code eine Content-Änderung
|
||
# macht. So geht nichts verloren, was seit dem letzten Sync über den
|
||
# Editor geändert wurde. Auf dem Server ausführen, aus ~/stack:
|
||
# ./sync-content-from-live.sh ~/sites/larpaso-website
|
||
set -euo pipefail
|
||
|
||
REPO="${1:-$HOME/sites/larpaso-website}"
|
||
|
||
docker compose cp admin:/app/content/site.json "$REPO/content/site.json"
|
||
docker compose cp admin:/app/content/theme.json "$REPO/content/theme.json"
|
||
|
||
cd "$REPO"
|
||
if git diff --quiet -- content/site.json content/theme.json; then
|
||
echo "Keine Änderungen – Git hat bereits den aktuellen Live-Stand."
|
||
else
|
||
git add content/site.json content/theme.json
|
||
git commit -m "Sync live content from admin panel"
|
||
git push
|
||
echo "Live-Inhalte wurden nach Git übernommen und gepusht."
|
||
fi
|