larpaso-website/sync-content-from-live.sh
Pascal Scholz f75296da44 Add sync/publish scripts for content changes made via Claude Code
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>
2026-09-24 22:49:01 +02:00

22 lines
893 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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