Dit artikel legt uit hoe je sites deployt naar GitLab Pages met behulp van GitLab CI.

Workflow

Maak .gitlab-ci.yml aan in de hoofdmap van je site met de volgende inhoud:

 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  rules:
15    - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
16
17pages:
18  script:
19    - hugo --gc --minify
20  artifacts:
21    paths:
22      - public
23  rules:
24    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH

Het bovenstaande voorbeeld deployt alleen de standaardbranch naar GitLab Pages en voert een test uit op de overige branches.

Zie ook: