feat: use persistent hugo resources folder #15

Merged
Vezpi merged 4 commits from feat/hugo-cache-dir into preview 2026-09-16 10:55:41 +02:00
Showing only changes of commit 564f9171bc - Show all commits
+17 -4
View File
@@ -5,7 +5,8 @@ set -e
REPO_URL="${REPO_URL:-https://git.vezpi.com/Vezpi/blog.git}" REPO_URL="${REPO_URL:-https://git.vezpi.com/Vezpi/blog.git}"
URL="${URL:-blog.vezpi.com}" URL="${URL:-blog.vezpi.com}"
BRANCH="${BRANCH:-preview}" BRANCH="${BRANCH:-preview}"
CLONE_DIR="${CLONE_DIR:-/blog}" BLOG_DIR="${BLOG_DIR:-/blog}"
HUGO_RESOURCE_DIR="${HUGO_RESOURCE_DIR:-/hugo-cache}"
DRAFTS="" DRAFTS=""
# Add drafts for preview # Add drafts for preview
@@ -15,15 +16,27 @@ if [ "$BRANCH" = "preview" ]; then
fi fi
# Clean blog dir # Clean blog dir
rm -rf "$CLONE_DIR" rm -rf "$BLOG_DIR"
# Create Hugo resource folder
mkdir -p "$HUGO_RESOURCE_DIR"
# Clone repo # Clone repo
echo "- Cloning $REPO_URL (branch: $BRANCH)..." echo "- Cloning $REPO_URL (branch: $BRANCH)..."
git clone --recurse-submodules --branch "$BRANCH" "$REPO_URL" "$CLONE_DIR" git clone --recurse-submodules --branch "$BRANCH" "$REPO_URL" "$BLOG_DIR"
# Generate static files with hugo # Generate static files with hugo
echo "- Building site with Hugo v$HUGO_VERSION in $HUGO_DEST..." echo "- Building site with Hugo v$HUGO_VERSION in $HUGO_DEST..."
hugo --source "$CLONE_DIR" --destination "$HUGO_DEST" --baseURL="https://${URL}" ${DRAFTS} --logLevel info --cleanDestinationDir --gc --panicOnWarning --printI18nWarnings hugo --source "$BLOG_DIR" \
--destination "$HUGO_DEST" \
--resourceDir "$HUGO_RESOURCE_DIR" \
--baseURL="https://${URL}" \
${DRAFTS} \
--logLevel info \
--cleanDestinationDir \
--gc \
--panicOnWarning \
--printI18nWarnings
# Start nginx # Start nginx
echo "- Starting Nginx..." echo "- Starting Nginx..."