Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.65 KiB
stages:
  - update
  - build
  - deploy

update_publications:
  stage: update
  script:
    - git checkout -B ${CI_BUILD_REF_NAME}
    - git submodule update --init --remote
    - git add publications
    - git commit -m "[AUTO] Updating publications submodule" || exit 0
    - git remote rm rw || true
    - git remote add rw git@gitlab.doc.ic.ac.uk:${CI_PROJECT_PATH}.git
    - eval `ssh-agent`
    - echo "$PUSH_KEY" | ssh-add -
    - git push rw ${CI_BUILD_REF_NAME}
  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
  image: ignoredambience/github-gitlab-sync
  tags:
    - docker
  only:
    - triggers

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

deadlinks:
  stage: deploy
  image: "ruby:2.4"
  tags:
    - docker
  before_script:
    - bundle install --deployment --without=development --with=test
  script:
    - bundle exec rake -s --suppress-backtrace . testlinks
  allow_failure: true
  except:
    - triggers

deploy:
  stage: deploy
  environment: production
  script:
    - "umask 0002 && rsync --chmod=Dg+s,ug+rwX,o+rX --chown=:rr -igrp --delete _site/ /vol/rr/www"
  tags:
    - auth-rr
  only:
    - master
  except:
    - triggers
variables:
  NOKOGIRI_USE_SYSTEM_LIBRARIES: "true"

cache:
  paths:
    - vendor/bundle/