Skip to content
Snippets Groups Projects
.gitlab-ci.yml 828 B
Newer Older
Dan Thomson's avatar
Dan Thomson committed
---
image: ruby:3

variables:
  JEKYLL_ENV: production
  LC_ALL: en_US.UTF-8

before_script:
  - gem install bundler
  - bundle install

test:
  stage: test
  script:
    - bundle exec jekyll build -d test
Dan Thomson's avatar
Dan Thomson committed
  artifacts:
    paths:
    - test
  rules:
    - if: "$CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH"

pages:
  stage: deploy
  script:
    - apt-get update && apt-get -y install yq
    - PAGES_PATH=$(echo $CI_PAGES_URL | sed 's;^\(https\?://[^/]\+\)\(/\?.*\);\1;')
    - PAGES_BASEURL=$(echo $CI_PAGES_URL | sed 's;^\(https\?://[^/]\+\)\(/\?.*\);\2;')
    - yq ".baseurl = \"$PAGES_BASEURL\" | .url = \"$PAGES_PATH\""  _config.yml > _config.yml.1
    - mv _config.yml.1 _config.yml
Dan Thomson's avatar
Dan Thomson committed
    - bundle exec jekyll build -d public
  artifacts:
    paths:
      - public
  rules:
    - if: "$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH"