From 1ecef7916a2346a23764a89e35e1ca899403baa3 Mon Sep 17 00:00:00 2001
From: Rastislav Kubala <rastislav.kubala@vsb.cz>
Date: Wed, 18 Mar 2020 13:03:25 +0100
Subject: [PATCH] Deploy to "master"

---
 .gitlab-ci.yml | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f4c521f2f..d80827337 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -126,7 +126,7 @@ deploy to production:
   - master@sccs/docs.it4i.cz
   when: manual
 
-deploy to docs_devel:
+deploy to stage on docs_devel:
   environment: stage
   stage: deploy
   image: it4innovations/docker-mkdocscheck:latest
@@ -147,3 +147,26 @@ deploy to docs_devel:
   - rsync -a --delete site/ root@"$SSH_HOST_STAGE_DEV":/srv/docs-devel.it4i.cz/devel/$CI_BUILD_REF_NAME/
   only:
   - branches@sccs/docs.it4i.cz
+
+deploy to production on docs_devel:
+  environment: master
+  stage: deploy
+  image: it4innovations/docker-mkdocscheck:latest
+  before_script:
+  # install ssh-agent
+  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
+  - 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
+  # run ssh-agent
+  - eval $(ssh-agent -s)
+  # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
+  - ssh-add <(echo "$SSH_PRIVATE_KEY_DEV")
+  # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
+  # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
+  - mkdir -p ~/.ssh
+  - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
+  script:
+  - chown nginx:nginx site -R
+  - rsync -a --delete site/ root@"$SSH_HOST_STAGE_DEV":/srv/docs.it4i.cz/site/
+  only:
+  - master@sccs/docs.it4i.cz
+  when: manual
-- 
GitLab