Skip to content

Update production script #1280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions scripts/production.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
# Run this from root by calling sh ./scripts/production.sh

# Build the English docs from this branch

# Update Hugo if necessary
hugo mod get -u
# Clear out previous build artifacts
rm -rf public
if [ -n "$CF_PAGES_URL" ]; then
echo "Building in Cloudflare"
hugo -b $CF_PAGES_URL

# Detect whether we are in Cloudflare
if [ -n "$CF_PAGES" ] && [ -n "$CF_PAGES_URL" ]; then
echo "Building in Cloudflare with these variables:"
echo " CF_PAGES: $CF_PAGES"
echo " CF_PAGES_URL: $CF_PAGES_URL"
echo " CF_PAGES_COMMIT_SHA: $CF_PAGES_COMMIT_SHA"
echo " CF_PAGES_BRANCH: $CF_PAGES_BRANCH"
if [ "$CF_PAGES_BRANCH" = "main" ]; then
echo "Building the main site"
hugo
else
echo "Building a PR preview"
hugo -b $CF_PAGES_URL
fi
else
echo "Building locally"
hugo
fi

# Move English sitemap into root
rm public/sitemap.xml
mv public/en/sitemap.xml public/sitemap.xml
mv public/en/sitemap.xml public/

# Clear Hugo translated content, which we don't yet use
rm -rf public/ja
rm -rf public/ko

Expand Down