-
-
Notifications
You must be signed in to change notification settings - Fork 245
/
build.sh
executable file
·30 lines (26 loc) · 857 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
shopt -s dotglob
# do not index the site on Netlify (only index the one built on Vercel)
if [ "$NETLIFY" = "true" ]; then
cd static
echo 'User-agent: *
Disallow: /' > robots.txt
cd ..
fi
# Vercel only does a shallow clone, which loses git info
if [ "$VERCEL_ENV" = "production" ]; then
rm -rf *
git clone --recursive -b $VERCEL_GIT_COMMIT_REF https://github.com/$VERCEL_GIT_REPO_OWNER/$VERCEL_GIT_REPO_SLUG.git .
git config advice.detachedHead false
git checkout $VERCEL_GIT_COMMIT_SHA
fi
# Netlify uses $CONTEXT and Vercel uses $VERCEL_ENV
if [ "${VERCEL_ENV:-$CONTEXT}" = "production" ]; then
hugo -F --enableGitInfo
else
hugo -F -D -b ${VERCEL_URL:-$DEPLOY_PRIME_URL} --enableGitInfo
fi
# add litedown documentation
cd public
git clone --depth 1 -b gh-pages https://github.com/yihui/litedown litedown
rm -rf litedown/.git