blog-deploy/entry.sh
2025-05-08 13:05:36 +02:00

38 lines
1.1 KiB
Bash

#!/bin/sh
apk add --no-cache git wget mkdocs-material py3-regex py3-requests py3-colorama
mkdir -p /repo
cd /repo
#rm -rf -- /repo/..?* /repo/.[!.]* /repo/*
while true; do
echo "$(date): Cloning or updating the repository..."
git config --global --add safe.directory /repo
git config --global --add http.proxy socks5h://localhost:9050
git config --global pull.rebase true
if [ -d "/repo/.git" ]; then
git stash
#git submodule foreach 'git stash; git reset --hard'
#git submodule foreach 'git checkout main ; git pull'
#git restore .
git pull origin "${BRANCH}"
git submodule update --force --recursive --remote --depth=1
git submodule foreach 'git stash ; git checkout main ; git pull'
else
git clone -b "${BRANCH}" "${REPO_URL}" /repo --recursive --shallow-submodules --depth=1
git submodule update --recursive --remote
fi;
sed -i "s/^site_url:.*//g" /repo/mkdocs.yml
echo "site_url: ${SITE_URL}" >> /repo/mkdocs.yml
echo "Building mkdocs site..."
# remove old contents
rm -rf /servable/*
## do necessarry transition related fixes
#sh blogfix.sh
mkdocs build -d /servable
sleep $REFRESH_SEC
done