From 3aa86d09c5cf61415659c23245563e5ab86b1257 Mon Sep 17 00:00:00 2001
From: Nils Mittler <nils.mittler@mni.thm.de>
Date: Thu, 15 Apr 2021 14:21:10 +0200
Subject: [PATCH] add staging deployment job

---
 .gitlab-ci.yml | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index be06daa79..167468df4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -38,7 +38,7 @@ unit_tests:
 sonar:
   stage: codestyle
   only:
-    - master
+    - staging
   tags:
     - sonar-cli
   allow_failure: true
@@ -62,7 +62,23 @@ ngbuild:
     paths:
       - "$BUILD_DIR"
 
-deploy:
+deploy_staging:
+  stage: deploy
+  only:
+    - staging
+  tags:
+    - ssh
+  dependencies:
+    - tslint
+    - ngbuild
+  script:
+    - eval $(ssh-agent -s)
+    - mkdir ~/.ssh
+    - ssh-keyscan "$STAGING_SERVER_URL" >> ~/.ssh/known_hosts
+    - ssh-add <(echo "$SSH_PRIVATE_KEY")
+    - scp -r "$BUILD_DIR"* "$STAGING_SSH_URL"
+
+deploy_production:
   stage: deploy
   only:
     - master
-- 
GitLab