Created
June 1, 2025 17:43
-
-
Save lonelydev/0346bcd2d862c9f4882a6de92d032859 to your computer and use it in GitHub Desktop.
Deploy your Hugo website on AWS Amplify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 1 | |
env: | |
variables: | |
# Application versions | |
DART_SASS_VERSION: 1.87.0 | |
GO_VERSION: 1.24.2 | |
HUGO_VERSION: 0.147.1 | |
# Time zone | |
TZ: America/Los_Angeles | |
# Cache | |
HUGO_CACHEDIR: ${PWD}/.hugo | |
NPM_CONFIG_CACHE: ${PWD}/.npm | |
frontend: | |
phases: | |
preBuild: | |
commands: | |
# Install Dart Sass | |
- curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz | |
- sudo tar -C /usr/local/bin -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz | |
- rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz | |
- export PATH=/usr/local/bin/dart-sass:$PATH | |
# Install Go | |
- curl -LJO https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | |
- sudo tar -C /usr/local -xf go${GO_VERSION}.linux-amd64.tar.gz | |
- rm go${GO_VERSION}.linux-amd64.tar.gz | |
- export PATH=/usr/local/go/bin:$PATH | |
# Install Hugo | |
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz | |
- sudo tar -C /usr/local/bin -xf hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz | |
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz | |
- export PATH=/usr/local/bin:$PATH | |
# Check installed versions | |
- go version | |
- hugo version | |
- node -v | |
- npm -v | |
- sass --embedded --version | |
# Install Node.JS dependencies | |
- "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci --prefer-offline || true" | |
# https://github.com/gohugoio/hugo/issues/9810 | |
- git config --add core.quotepath false | |
build: | |
commands: | |
- hugo --gc --minify | |
artifacts: | |
baseDirectory: public | |
files: | |
- '**/*' | |
cache: | |
paths: | |
- ${HUGO_CACHEDIR}/**/* | |
- ${NPM_CONFIG_CACHE}/**/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment