mirror of
https://github.com/CPunch/openpunk-ansible.git
synced 2024-11-22 15:30:05 +00:00
28 lines
714 B
Bash
28 lines
714 B
Bash
#!/bin/bash
|
|
cd /var/www/{{ domain }}
|
|
|
|
PUBLIC_DIR=public
|
|
TOR_DIR=tor
|
|
|
|
buildBlog () {
|
|
hugo --cleanDestinationDir --minify -d $PUBLIC_DIR -b https://{{ domain }}
|
|
hugo --cleanDestinationDir --minify -d $TOR_DIR -b {{ onionDomain }}
|
|
}
|
|
|
|
git fetch origin
|
|
UPSTREAM=${1:-'@{u}'}
|
|
LOCAL=$(git rev-parse @)
|
|
REMOTE=$(git rev-parse "$UPSTREAM")
|
|
BASE=$(git merge-base @ "$UPSTREAM")
|
|
if [ $LOCAL = $REMOTE ]; then
|
|
echo "up to date"
|
|
elif [ $LOCAL = $BASE ]; then
|
|
# there are changes to reset too
|
|
# && we need to update our blog
|
|
echo "missing changes!!"
|
|
git reset --hard origin/main
|
|
buildBlog
|
|
elif [ ! -d "$PUBLIC_DIR" ] || [ ! -d "$TOR_DIR" ]; then
|
|
echo "missing directories..."
|
|
buildBlog
|
|
fi |