Skip to content

Build and Deploy Hugo Site with Nix #73

Build and Deploy Hugo Site with Nix

Build and Deploy Hugo Site with Nix #73

Workflow file for this run

name: Hugo Website Deployment
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
submodules: recursive # Fetch the Docsy theme
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.109.0"
extended: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.12.1'
cache: 'npm'
# The action defaults to search for the dependency file (package-lock.json,
# npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its
# hash as a part of the cache key.
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
cache-dependency-path: '**/package-lock.json'
- run: npm ci
- name: Build
# remove --minify tag if you do not need it
# docs: https://gohugo.io/hugo-pipes/minification/
run: hugo
#run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.TOKEN_FOR_HUGO }}
#external_repository: <username>/<username>.github.io
publish_dir: ./public
# keep_files: true <-- usually, all files in the deployment folder are replaced
#user_name: Mullana
#user_email: [email protected]
#publish_branch: main
# cname: example.com <-- necessary when a custom domain is used