Replace rsync with git pull in sync-vps.sh
This commit is contained in:
+3
-16
@@ -1,24 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Pull markdown content from VPS, commit any changes, then push everything back.
|
# Pull web-edit commits from VPS, then push everything back.
|
||||||
# Usage: bash scripts/sync-vps.sh
|
# Usage: bash scripts/sync-vps.sh
|
||||||
set -e
|
set -e
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
VPS=root@95.216.55.151
|
echo "==> Pulling web-edit commits from VPS..."
|
||||||
REMOTE=/opt/bincio_wiki
|
git pull --rebase vps main
|
||||||
|
|
||||||
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..."
|
echo "==> Pushing site submodule to VPS..."
|
||||||
(cd site && git push vps main)
|
(cd site && git push vps main)
|
||||||
|
|||||||
Reference in New Issue
Block a user