2023-07-26 20:22:25 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# stop on error
|
|
|
|
set -e -v
|
|
|
|
|
2023-07-28 07:18:39 +00:00
|
|
|
{
|
|
|
|
# Log date
|
|
|
|
date
|
2023-07-26 20:22:25 +00:00
|
|
|
|
2023-07-28 07:18:39 +00:00
|
|
|
# check if initial git run
|
|
|
|
if [ ! -d /repo ]; then
|
|
|
|
# yes - repo needs to be cloned
|
|
|
|
git clone --recurse-submodules $REPO_URL /repo
|
|
|
|
else
|
|
|
|
# no - pull existing repo
|
|
|
|
cd /repo && git pull --recurse-submodules
|
|
|
|
fi
|
2023-07-26 20:22:25 +00:00
|
|
|
|
2023-07-28 07:18:39 +00:00
|
|
|
# build and copy over
|
|
|
|
cd /repo && \
|
|
|
|
hugo && \
|
|
|
|
rm -rf /usr/share/nginx/html/* && \
|
|
|
|
cp -R /repo/public/* /usr/share/nginx/html
|
|
|
|
|
|
|
|
} 2>&1 > /var/log/blogker-pull-n-build.log
|