This article explains how to deploy sites to GitLab Pages using GitLab CI.

Workflow#

Create .gitlab-ci.yml at the root of your site with the following contents:

 1image: registry.gitlab.com/pages/hugo/hugo_extended:latest
 2
 3variables:
 4  HUGO_ENV: production
 5
 6default:
 7  before_script:
 8    - apk add --update --no-cache git go npm
 9    - npm install
10
11test:
12  script:
13    - hugo --gc --minify
14
15pages:
16  script:
17    - hugo --gc --minify
18  artifacts:
19    paths:
20      - public

See also Starter Template GitLab Pages Configuration