Add sync-vps.sh: pull content from VPS, commit, push both repos

This commit is contained in:
brutsalvadi
2026-05-07 12:18:17 +02:00
parent 75b8f16375
commit 859e8cbbad
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Pull markdown content from VPS, commit any changes, then push everything back.
# Usage: bash scripts/sync-vps.sh
set -e
cd "$(dirname "$0")/.."
VPS=root@95.216.55.151
REMOTE=/opt/bincio_wiki
echo "==> Syncing pages/ and blog/ from VPS..."
rsync -az --delete --exclude='.git' "$VPS:$REMOTE/pages/" pages/
rsync -az --delete --exclude='.git' "$VPS:$REMOTE/blog/" blog/
echo "==> Checking for content changes..."
if [ -n "$(git status --porcelain pages/ blog/)" ]; then
git add pages/ blog/
git commit -m "updated pages/blog from vps"
echo " Committed content changes."
else
echo " No changes."
fi
echo "==> Pushing site submodule to VPS..."
(cd site && git push vps main)
echo "==> Pushing container repo to VPS..."
git push vps main
echo "==> Done."