From bb1715f671f9845cd45f93195500d88ea6920ecb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mikl=C3=B3s=20T=C3=B3th?= <tothmiklostibor@gmail.com>
Date: Sat, 5 Mar 2022 11:05:37 +0100
Subject: [PATCH] Add frontend to CI/CD

---
 .gitlab-ci.yml | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 116383d..17f294d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -140,4 +140,40 @@ deploy backend:
       - backend/**/*
       - .gitlab-ci.yml
     refs:
-      - main
\ No newline at end of file
+      - main
+
+build web frontend:
+  stage: build
+  image: gradle:7.1
+  script:
+    - cd mosogepsch
+    - ./gradlew jsBrowserProductionWebpack
+  artifacts:
+    paths:
+      - mosogepsch/build/distributions
+  only:
+    changes:
+      - mosogepsch/**/*
+      - .gitlab-ci.yml
+
+
+deploy web frontend:
+  stage: deploy
+  image: kroniak/ssh-client
+  before_script:
+    - eval $(ssh-agent -s)
+    - echo "$SSH" | tr -d '\r' | ssh-add -
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+    - 'echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
+  needs:
+    - build web frontend
+  script:
+    - scp mosogepsch/build/distributions/* $MOSOGEPSCH_HOST:/opt/mosogepsch/frontend
+  only:
+    changes:
+      - mosogepsch/**/*
+      - .gitlab-ci.yml
+    refs:
+      - main
+
-- 
GitLab