Skip to content
Snippets Groups Projects
Forked from Verified Software / psvg.doc.ic.ac.uk
241 commits behind the upstream repository.
.gitlab-ci.yml 2.00 KiB
stages:
  - update
  - build
  - deploy

image: "ruby:2.6-stretch"
variables:
  NOKOGIRI_USE_SYSTEM_LIBRARIES: "true"

build:
  stage: build
  artifacts:
    paths:
      - _site/
    expire_in: 1 day
  cache:
    paths:
      - vendor/bundle/
  except:
    - triggers
  tags:
    - docker
  before_script:
    - bundle install --deployment --without=development --with=test
    - bundle exec rake init
  script:
    - bundle exec rake -s --suppress-backtrace . test

deadlinks:
  stage: deploy
  allow_failure: true
  cache:
    paths:
      - vendor/bundle/
  except:
    - triggers
  tags:
    - docker
  before_script:
    - bundle install --deployment --without=development --with=test
  script:
    - bundle exec rake -s --suppress-backtrace . testlinks

deploy:
  stage: deploy
  environment: production
  image: resourcereasoning/website-deploy
  tags:
    - docker
  only:
    - master
  except:
    - triggers
  # DOC_DEPLOY_USER and DOC_DEPLOY_KEY should be defined as secret variables in the GitLab CI Settings panel
  before_script:
    - eval `ssh-agent`
    - echo "$DOC_DEPLOY_KEY" | ssh-add -
  script:
    - ./.deploy.sh

# Special target triggered when publications repository is updated:
update_publications:
  stage: update
  variables:
    GIT_AUTHOR_NAME: Resource Reasoning Group Backup Bot
    GIT_COMMITTER_NAME: Resource Reasoning Group Backup Bot
    GIT_AUTHOR_EMAIL: rr-gitlab-bot@example.com
    EMAIL: rr-gitlab-bot@example.com
    # PUSH_KEY should be defined as a secret variable in the GitLab UI
    SSH_KEY: $PUSH_KEY