zola-app/rebuild.sh

35 lines
680 B
Bash
Raw Permalink Normal View History

2020-11-12 12:01:14 +01:00
#!/bin/bash
set -eu
REPO_PATH=/run/repo
WEB_PATH=/run/html
. /app/data/config.sh
if [ "$REPO_URL" == "" ]; then
echo "No REPO_URL set!"
exit 1
fi
if ! [ -d "$REPO_PATH" ]; then
git clone "$REPO_URL" "$REPO_PATH"
fi
cd "$REPO_PATH"
git pull
2020-11-12 16:54:28 +01:00
git submodule init
2020-11-12 12:01:14 +01:00
git submodule update
zola build
2020-11-12 16:56:43 +01:00
if [ "$COMPRESS_CMD" != "" ]; then
echo "Compressing files..."
find public -type f -name '*.css' -size +5k -exec $COMPRESS_CMD '{}' \;
find public -type f -name '*.js' -size +5k -exec $COMPRESS_CMD '{}' \;
find public -type f -name '*.html' -size +5k -exec $COMPRESS_CMD '{}' \;
fi
2020-11-12 12:01:14 +01:00
echo "Updating webpage..."
mkdir -p "$WEB_PATH"
rsync -av --del public/ "$WEB_PATH/"