Static site deployment with Gitlab Pages

As you may already know, we heart gitlab. It tracks our source code changes, our bugs and issues. It tests our code with gitlab-ci and it even manages our website. Gitlab pages is a fantastic way to host a static website without ever spinning up a server.

Jekyll is a simple, blog-aware, static site generator. We use it to generate this site. As we push blog posts, content and images to our ‘www’ repository in gitlab, the site is re-generated using the latest content and pushed into gitlab pages. The actual ‘guts’ of that pipeline is a simple YAML file:

image: ruby:2.3

variables:
  JEKYLL_ENV: production

before_script:
  - bundle install

test:
  stage: test
  script:
  - cd site
  - bundle exec jekyll build -d ../test
  artifacts:
    paths:
    - test
  except:
  - master

pages:
  stage: deploy
  script:
  - cd site
  - bundle exec jekyll build -d ../public
  artifacts:
    paths:
    - public
  only:
  - master

This pipeline will test our code’s ability to be compiled any time we push to a branch other than ‘master’ and will publish our site any time we push to the ‘master’ branch. The new, static site contents will then be available for all to see on ‘http//aethereal.io’.

Phone

(612) 840-6253

Address

750 Margaret Street
Saint Paul, MN 55106
United States of America