Files
staticzolaserver-docker/git2zola.sh
T

47 lines
995 B
Bash
Executable File

#!/bin/bash
# bash deamon to check git for new content
# make a pull from repository
# - with ssh keys ( problem with private key in this repository )
# - with https user login ( problrm with TLS error with own gogs
# - with auth token (not implemented in gogs yet)
#default sws docker path
OUTPUT_DIR='/public'
BASE_URL='docker.local'
GITPROJECTNAME=serinty-website
GITPROJECTUSER=Serinty
GITSERVER=gogs.serinty.net
GITSERVERPORT=22104
GITUSER=gogs
GITPASSWD=gogspw
if [ -z $IDLE_TIME ]
then
# one day
IDLE_TIME=86400
fi
trap "exit" EXIT
while true
do
git status --porcelain
gitstatus=$?
echo ${gitstatus}
if [ ${gitstatus} -eq 128 ]
then
git clone ${GITCLONEURL}
elif [ ${gitstatus} -eq 0 ]
then
gitpull=$(git pull --dry-run --ff-only)
if [ ! -z ${gitpull} ]
then
git pull --ff-only
zola build --base-url $BASE_URL --output-dir $OUTPUT_DIR
fi
fi
sleep ${IDLE_TIME}
done