---
# Publishes a hugo repo as GitLab pages.
# The job name must be pages for it to work.

pages:
  image: registry.gitlab.com/notno/hugo
  # Add a before script to add an external theme, for example:
  # before_script:
  #   - git clone https://github.com/matcornic/hugo-theme-learn.git themes/hugo-theme-learn
  variables:
    MINIFY: "false"
    EXTRA_ARGS: ""
  script:
    - |
      if [ ${MINIFY} = "true" ]; then
        hugo --minify ${EXTRA_ARGS}
        /minify.sh .
      else
        hugo ${EXTRA_ARGS}
      fi
    - gzip -kr public
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
