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."