Professional Documents
Culture Documents
AWS Hugo Deployment Guide
AWS Hugo Deployment Guide
AWS := aws
HUGO := hugo
PUBLIC_FOLDER := public
HTMLPROOF := htmlproofer
S3_BUCKET = s3://example.com/
CLOUDFRONT_ID := ABCD12345678
DOMAIN = example.com
SITEMAP_URL = https://example.com/sitemap.xml
DEPLOY_LOG := deploy.log
.ONESHELL:
all : serve
check:
$(HUGO) check
$(HUGO) --i18n-warnings
$(HTMLPROOF) --check-html \
--http-status-ignore 999 \
--internal-domains $(DOMAIN),localhost:1313 \
--disable-external \
--assume-extension \
$(PUBLIC_FOLDER)
benchmarking:
$(HUGO) --stepAnalysis --templateMetrics --templateMetricsHints
build: clean
$(HUGO)
build-production: clean
HUGO_ENV=production $(HUGO) --minify
serve: clean
$(HUGO) serve
serve-production: clean
HUGO_ENV=production $(HUGO) serve
update-themes:
git submodule update --remote --merge
# git submodule foreach git pull origin master
# recipe to manually invalidate all files if deploy recipe fails invalidation due
to complex filenames
aws-cloudfront-invalidate-all:
$(AWS) cloudfront create-invalidation --distribution-id $(CLOUDFRONT_ID)
--paths "/*"
clean :
find . -name "*~" -exec rm {} -v \;
find . -name "*#" -exec rm {} -v \;
hugo --gc
rm -vfr public