.gitlab-ci.yml 1.21 KB
Newer Older
Tom Wiesing's avatar
Tom Wiesing committed
1
image: kwarc/jekyll-website-deployer
Tom Wiesing's avatar
Tom Wiesing committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
stages:
  - deploy

before_script:
  # 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

  # 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 )'
  
  # 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:
  stage: deploy
  script:
    # build the website
    - bundle exec jekyll build -d _site
    # copy over all the files into the deployment folder
Tom Wiesing's avatar
Tom Wiesing committed
39
    - cd _site && rsync -rv -e "ssh -p $SSH_DEPLOY_PORT" --checksum --exclude='Gemfile' --delete-excluded --delete ./ root@static.kwarc.info:/root/data --delete
Tom Wiesing's avatar
Tom Wiesing committed
40 41
  only:
    - master