From 0c564b55292bc94f982769be22eeffcbc281b710 Mon Sep 17 00:00:00 2001
From: Michael Kohlhase <michael.kohlhase@fau.de>
Date: Thu, 21 Dec 2017 19:01:10 +0100
Subject: [PATCH] new setup after
 https://gl.kwarc.info/static/template.kwarc.info#static-website-template

---
 .gitlab-ci.yml | 56 ++++++++++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3e9cf7f..50694c1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,31 +1,39 @@
-# This file is a template, and might need editing before it works on your project.
-# Template project: https://gitlab.com/pages/jekyll
-# Docs: https://docs.gitlab.com/ce/pages/
-image: ruby:2.3
-
-variables:
-  JEKYLL_ENV: production
+image: kwarc/jekyll-website-deployer
+stages:
+  - deploy
 
 before_script:
-- bundle install
+  # 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
 
-test:
-  stage: test
-  script:
-  - bundle exec jekyll build -d test
-  artifacts:
-    paths:
-    - test
-  except:
-  - master
+  # 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 )'
 
-pages:
+  # 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:
-  - bundle exec jekyll build -d public
-  artifacts:
-    paths:
-    - public
+    # 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
   only:
-  - master
-
+    - master
-- 
GitLab