.gitlab-ci.yml 1.16 KB
Newer Older
1 2 3
image: kwarc/jekyll-website-deployer
stages:
  - deploy
Michael Kohlhase's avatar
Michael Kohlhase committed
4 5

before_script:
6 7 8 9 10 11
  # setup locales
  - echo "en_US UTF-8" > /etc/locale.gen
  - which locale-gen || ( apt-get update -y && apt-get install locales )
  - export LANG=en_US.UTF-8
  - export LANGUAGE=en_US:en
  - export LC_ALL=en_US.UTF-8
Michael Kohlhase's avatar
Michael Kohlhase committed
12

13 14 15 16 17 18 19 20
  # install ssh-agent, unless already there
  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'

  # install rsync, unless already there
  - 'which rsync || ( apt-get update -y && apt-get install rsync -y )'

  # install bundler, unless already there
  - 'which bundle || ( gem install bundler )'
Michael Kohlhase's avatar
Michael Kohlhase committed
21

22 23 24 25 26 27 28 29 30 31
  # and install the bundle
  - bundle install

  # setup ssh agent with the private key
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$SSH_PRIVATE_KEY")
  - mkdir -p ~/.ssh
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

deploy_staging:
Michael Kohlhase's avatar
Michael Kohlhase committed
32 33
  stage: deploy
  script:
34 35 36 37
    # build the website
    - bundle exec jekyll build -d _site
    # copy over all the files into the deployment folder
    - cd _site && rsync -rv -e ssh --checksum ./ deploy@static.kwarc.info:/var/www/SIGMathLing.kwarc.info --delete
Michael Kohlhase's avatar
Michael Kohlhase committed
38
  only:
39
    - master