2022-05-31 00:32:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
cd /var/www/{{ domain }}
|
2023-01-16 23:17:07 +00:00
|
|
|
|
2023-01-17 23:32:47 +00:00
|
|
|
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
|
2023-01-17 23:52:47 +00:00
|
|
|
# this string is hardcoded && checked by the 'Build blog' task
|
|
|
|
# to check for changes (changed_when)
|
2023-01-17 23:41:25 +00:00
|
|
|
echo "up to date"
|
2023-01-17 23:32:47 +00:00
|
|
|
elif [ $LOCAL = $BASE ]; then
|
2023-01-17 23:52:47 +00:00
|
|
|
# there are changes to reset too so we need to rebuild
|
|
|
|
echo "missing changes !!"
|
2023-01-17 23:32:47 +00:00
|
|
|
git reset --hard origin/main
|
|
|
|
buildBlog
|
2023-01-17 23:52:47 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$PUBLIC_DIR" ] || [ ! -d "$TOR_DIR" ]; then
|
|
|
|
# probably first time setup
|
|
|
|
echo "missing directories !!"
|
2023-01-17 23:32:47 +00:00
|
|
|
buildBlog
|
|
|
|
fi
|