Skip to content

Commit 9e70179

Browse files
committed
Adding script to get render preview to work
1 parent 2f43e42 commit 9e70179

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

render-script.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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.147.3
9+
OS_VERSION="Linux-64bit"
10+
#OS_VERSION="darwin-universal" # uncomment to test on mac osx
11+
12+
./themes/hugo-bibliography/fetch-zotero.sh
13+
14+
if [[ ! -f $XDG_CACHE_HOME/hugo ]]; then
15+
echo "...Downloading HUGO"
16+
mkdir -p ~/tmp
17+
wget -P ~/tmp https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_${OS_VERSION}.tar.gz
18+
cd ~/tmp
19+
echo "...Extracting HUGO"
20+
tar -xzvf hugo_extended_${HUGO_VERSION}_${OS_VERSION}.tar.gz
21+
echo "...Moving HUGO"
22+
mv hugo $XDG_CACHE_HOME/hugo
23+
cd $HOME/project/src # Make sure we return to where we were
24+
else
25+
echo "...Using HUGO from build cache"
26+
fi
27+
28+
$XDG_CACHE_HOME/hugo version # Output the NEW version
29+
30+
# Render sets IS_PULL_REQUEST to true for PR previews.
31+
if [ "${IS_PULL_REQUEST:-}" = "true" ]; then
32+
echo "Base url:"
33+
echo $RENDER_EXTERNAL_URL
34+
$XDG_CACHE_HOME/hugo --gc -e preview -b $RENDER_EXTERNAL_URL
35+
else
36+
$XDG_CACHE_HOME/hugo --gc --minify -b https://ag-institutional-rse-networking.onrender.com/
37+
38+
fi

0 commit comments

Comments
 (0)