fix: remove cacheDir and use symlink
This commit is contained in:
@@ -6,7 +6,7 @@ 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}"
|
||||||
BLOG_DIR="${BLOG_DIR:-/blog}"
|
BLOG_DIR="${BLOG_DIR:-/blog}"
|
||||||
HUGO_CACHE_DIR="${HUGO_CACHE_DIR:-/hugo-cache}"
|
HUGO_RESOURCE_DIR="${HUGO_RESOURCE_DIR:-/hugo-resources}"
|
||||||
DRAFTS=""
|
DRAFTS=""
|
||||||
|
|
||||||
# Add drafts for preview
|
# Add drafts for preview
|
||||||
@@ -18,18 +18,18 @@ fi
|
|||||||
# Clean blog dir
|
# Clean blog dir
|
||||||
rm -rf "$BLOG_DIR"
|
rm -rf "$BLOG_DIR"
|
||||||
|
|
||||||
# Create Hugo resource folder
|
|
||||||
mkdir -p "$HUGO_CACHE_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" "$BLOG_DIR"
|
git clone --recurse-submodules --branch "$BRANCH" "$REPO_URL" "$BLOG_DIR"
|
||||||
|
|
||||||
|
# Restore persistent Hugo resources cache
|
||||||
|
rm -rf "$CLONE_DIR/resources"
|
||||||
|
ln -s "$HUGO_RESOURCE_DIR" "$CLONE_DIR/resources"
|
||||||
|
|
||||||
# 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 "$BLOG_DIR" \
|
hugo --source "$BLOG_DIR" \
|
||||||
--destination "$HUGO_DEST" \
|
--destination "$HUGO_DEST" \
|
||||||
--cacheDir "$HUGO_CACHE_DIR" \
|
|
||||||
--baseURL="https://${URL}" \
|
--baseURL="https://${URL}" \
|
||||||
${DRAFTS} \
|
${DRAFTS} \
|
||||||
--logLevel info \
|
--logLevel info \
|
||||||
|
|||||||
Reference in New Issue
Block a user