0%

Hexo Auto Sync

This script automatically deploys the blog whenever a change is made locally or remotely:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

while true; do
git add -A && git commit -m -
git fetch
DIFF=$(git rev-list HEAD...origin/master —count)

if [ $DIFF -gt 0 ]; then
echo “Need to sync”
git pull
git push
hexo clean
hexo g
hexo d

else
echo “Up-to-date”

fi
sleep 10
done