Skip to content

Commit cbeea27

Browse files
authored
Merge pull request #140 from dh-tech/render-preview-fix
Render preview fix
2 parents dff2e2a + 7c69a96 commit cbeea27

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

render-build.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
# save as render-build.sh and make sure it's executable
4+
# update the version being used to match version being used in build
5+
6+
hugo version # Output the OLD version
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_extended_${HUGO_VERSION}_${OS_VERSION}.tar.gz
16+
cd ~/tmp
17+
echo "...Extracting HUGO"
18+
tar -xzvf hugo_extended_${HUGO_VERSION}_${OS_VERSION}.tar.gz
19+
echo "...Moving HUGO"
20+
mv hugo $XDG_CACHE_HOME/hugo
21+
cd $HOME/project/src # Make sure we return to where we were
22+
else
23+
echo "...Using HUGO from build cache"
24+
fi
25+
26+
$XDG_CACHE_HOME/hugo version # Output the NEW version
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)