From 859e8cbbadf71e8306cc7c1611d9d9b35614a2f5 Mon Sep 17 00:00:00 2001 From: brutsalvadi Date: Thu, 7 May 2026 12:18:17 +0200 Subject: [PATCH] Add sync-vps.sh: pull content from VPS, commit, push both repos --- scripts/sync-vps.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/sync-vps.sh diff --git a/scripts/sync-vps.sh b/scripts/sync-vps.sh new file mode 100755 index 0000000..2bf9ebf --- /dev/null +++ b/scripts/sync-vps.sh @@ -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."