Skip to content
Snippets Groups Projects
.gitlab-ci.yml 6.52 KiB
image: ruby:2.7

stages:
  - build
  - test
  - review
  - deploy

.artifacts_extension:
  artifacts:
    paths:
      - public
    expire_in: 1d

.cache_latest: &cache_latest
  cache:
    key: latest
    paths:
      - vendor/bundle

.cache_production: &cache_production
  cache:
    key: production
    paths:
      - vendor/bundle

.only_extension:
  only:
    - master

.common_production: &production_before_script
  before_script:
    - gem install bundler --no-document
    - bundle install --jobs $(nproc) --without test "${FLAGS[@]}"
  <<: *cache_production

.common_latest: &latest_before_script
  before_script:
    - "[[ -f \"Gemfile.lock\" ]] && rm Gemfile.lock"
    - bundle install --jobs $(nproc) --without test "${FLAGS[@]}"
    - bundle update --jobs $(nproc) "${FLAGS[@]}"
  <<: *cache_latest

.common_variables: &common_variables
  GIT_SUBMODULE_STRATEGY: recursive
  SUBPATH: "/"
  BUNDLE_PATH: vendor/bundle
  NOKOGIRI_USE_SYSTEM_LIBRARIES: "1"

.builds: &builds
  stage: build
  variables:
    <<: *common_variables
  script:
    - "bundle exec jekyll build --future \
        --config _config.yml \
        -d public$SUBPATH \
        --baseurl $SUBPATH"
    - "bash ./scripts/copy_favicons.bash \"_favicons/\" \"public/\" $SUBPATH"
  # https://docs.gitlab.com/ce/ci/yaml/#interruptible
  interruptible: true

.builds_reviewapps: &builds_reviewapps
  stage: build
  variables:
    <<: *common_variables
  script:
    - "bundle exec jekyll build --future \
        --config _config.yml,_config_reviewapps.yml \
        -d public$SUBPATH \