variables:
  GIT_SUBMODULE_STRATEGY: recursive

## GitLab defaults to:
# stages:
# - build
# - test
# - deploy

build-site:
  stage: build
  image: registry.gitlab.com/pages/hugo/hugo_extended
  script:
    - hugo
  artifacts:
    paths:
      - public

test-html:
  stage: test
  image:
    name: wjdp/htmltest:latest
    entrypoint: [""]
  cache:
    key: htmltest-cache
    paths:
      - tmp/
  script:
    - htmltest

test-trailing-spaces:
  stage: test
  needs: [] # ok to run before build-site
  script:
    - ./test_trailing_spaces.sh

# The GitLab Pages job must always be named "pages", and result in a "public" artifact.
# Our "public" artifact is created above, but GitLab jobs will fetch all artifacts from previous stages.
pages:
  stage: deploy
  script: ls -ld public
  artifacts:
    paths:
      - public
  only:
    - main
  # New pages are absolute links to prod, and are 404s until they get published.
  # Get around htmltest's chicken-and-egg problem. We're on `main`, just publish unconditionally.
  when: always