This page will show you how to deploy Hugo on GitLab pages.
If you already have a Hugo project pushed, the only step is to create the gitlab-ci.yml configuration file at the root of your repository, then populate it with:
default:
image: ghcr.io/hugomods/hugo:ci-non-root
variables:
GIT_SUBMODULE_STRATEGY: recursive
test:
script:
- hugo
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
deploy-pages:
script:
- hugo
pages: true
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
environment: productionIn this case, the hugomods/hugo:ci-non-root image is used as it offers a few more features than the official one.