Site Publishing - Matt Whipple

This site is published using GitLab Pages(“GitLab Pages | GitLab” 2021). At the moment this involves checking the generated site into the repository which GitLab then publishes, though automated generation will likely be done later.

The documentation for GitLab pages(“GitLab Pages | GitLab” 2021) is overall solid but it seems fairly example heavy which leaves the need for a fair amount of inference based on those examples. The publishing itself is handled by a .gitlab-ci.yml file and is tied to a “specific job called pages” within that file(“Keyword Reference for the .gitlab-Ci.yml File | GitLab #Pages” 2021).

.gitlab-ci.yml

Currently the file uses a standard alpine image with an unpinned version (tsk tsk):

image: alpine:latest

Publishing should only be done for the primary branch so a workflow will be configured to target branches (“Create a GitLab Pages Website from Scratch | GitLab” 2021).

workflow:
  rules:
    - if: '$CI_COMMIT_BRANCH'

The special pages job is defined which should be run during the deploy stage (“Create a GitLab Pages Website from Scratch | GitLab” 2021).

pages:
  stage: deploy

While no additional preparation is required, a script element is expected and therefore an effective no-op is added:

  script:
    - echo 'Nothing to do...'

The (already existing) public directory will be published as an artifact:

  artifacts:
    paths:
      - public

Deployment of updates should only be performed for the primary branch:

  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
“Create a GitLab Pages Website from Scratch | GitLab.” 2021. https://docs.gitlab.com/ee/user/project/pages/getting_started/pages_from_scratch.html.
“GitLab Pages | GitLab.” 2021. https://docs.gitlab.com/ee/user/project/pages/.
“Keyword Reference for the .gitlab-Ci.yml File | GitLab #Pages.” 2021. https://docs.gitlab.com/ee/ci/yaml/README.html#pages.