From 8fdcc6565ecdbe2087d7c95580e86f9405ae5ab4 Mon Sep 17 00:00:00 2001
From: Michael Gutbier <migu@cgan.de>
Date: Tue, 17 Dec 2019 21:27:50 +0100
Subject: [PATCH] test artifact publishing with GitLab

---
 .gitlab-ci.yml | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a6db116..566254c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,8 @@
-stages: [ build ]
+stages:
+  - build
+  - publish
 
-job_build:
+build_guide:
   stage: build
   image: ubuntu:latest
   script:
@@ -13,4 +15,22 @@ job_build:
     paths:
       - "angelguide_en.pdf"
       - "angelguide_de.pdf"
-    expire_in: 12 month
\ No newline at end of file
+    expire_in: 12 months
+
+publish_artifacts:
+  stage: publish
+  image: ubuntu:latest
+  before_script:
+    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
+    - eval $(ssh-agent -s)
+    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
+    - chmod 644 ~/.ssh/known_hosts
+  script:
+    - 'rsync -v angelguide_??.pdf $PUBLISHING_HOST:'
+  rules:
+    - if: '$CI_COMMIT_REF_NAME == "master"'
+      when: always
+    - when: never
-- 
GitLab