Skip to content

Commit ea7899d

Browse files
committed
Tweak render build script
1 parent dd3d226 commit ea7899d

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

render-build.sh

+21-9
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,32 @@
22

33
# save as render-build.sh and make sure it's executable
44
# update the version being used to match version being used in build
5+
56
hugo version # Output the OLD version
6-
if [[! -f $XDG_CACHE_HOME/hugo]]; then
7-
echo "...Downloading HUGO"
8-
mkdir -p ~/tmp
9-
wget -P ~/tmp https://github.com/gohugoio/hugo/releases/download/v0.142.0/hugo_0.142.0_Linux-64bit.tar.gz
7+
8+
HUGO_VERSION=0.142.0
9+
OS_VERSION="Linux-64bit"
10+
#OS_VERSION="darwin-universal" # uncomment to test on mac osx
11+
12+
if [[ ! -f $XDG_CACHE_HOME/hugo ]]; then
13+
echo "...Downloading HUGO"
14+
mkdir -p ~/tmp
15+
wget -P ~/tmp https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_${OS_VERSION}.tar.gz
1016
cd ~/tmp
11-
echo "...Extracting HUGO"
12-
tar -xzvf hugo_0.142.0_Linux-64bit.tar.gz
17+
echo "...Extracting HUGO"
18+
tar -xzvf hugo_${HUGO_VERSION}_${OS_VERSION}.tar.gz
1319
echo "...Moving HUGO"
14-
mv hugo $XDG_CACHE_HOME/hugo
20+
mv hugo $XDG_CACHE_HOME/hugo
1521
cd $HOME/project/src # Make sure we return to where we were
16-
else
22+
else
1723
echo "...Using HUGO from build cache"
1824
fi
1925

2026
$XDG_CACHE_HOME/hugo version # Output the NEW version
21-
$XDG_CACHE_HOME/hugo --gc --minify`
27+
28+
# Render sets IS_PULL_REQUEST to true for PR previews.
29+
if [ "${IS_PULL_REQUEST:-}" = "true" ]; then
30+
$XDG_CACHE_HOME/hugo --gc -e preview
31+
else
32+
$XDG_CACHE_HOME/hugo --gc --minify -b https://dh-tech.onrender.com/
33+
fi

0 commit comments

Comments
 (0)