From 95d93e7707b3fd11bff8bb418ff23ca4e7d8e296 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mathias=20G=C3=B6bel?= <goebel@sub.uni-goettingen.de>
Date: Tue, 20 Jul 2021 21:20:19 +0200
Subject: [PATCH] feat: add build with base path for backend

---
 .ci-scripts/set-path-base.sh |  4 ++++
 .gitlab-ci.yml               | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/.ci-scripts/set-path-base.sh b/.ci-scripts/set-path-base.sh
index 5c814c0..4e5f48a 100755
--- a/.ci-scripts/set-path-base.sh
+++ b/.ci-scripts/set-path-base.sh
@@ -4,9 +4,13 @@
 # Since our environments always have their respective branch name in the URL,
 # the base path has to be adjusted to that. Otherwise the files of the environment
 # will not be found.
+# To prepare an artifact the backend pipeline will collect, we set a specific 
+# base path.
 
 if [[ $1 == "main" ]]; then
     sed -i "s|base:\s*'/'|base: '/ahiqar/website/'|" src/.vuepress/config.js
+else if [[ $1 == "backend" ]]; then
+    sed -i "s|base:\s*'/'|base: '/website/'|" src/.vuepress/config.js
 else
     sed -i "s|base:\s*'/'|base: '/ahiqar/website/$1/'|" src/.vuepress/config.js
 fi
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0451a19..822b692 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,6 +28,19 @@ build_page:
     paths:
       - src/.vuepress/dist
 
+# this job creates a build to be included in the back end.
+build_page-backend:
+  image: node:lts-alpine3.10
+  stage: build
+  script:
+    - ash .ci-scripts/set-path-base.sh backend
+    - npm i
+    - node_modules/.bin/vuepress build src
+  artifacts:
+    paths:
+      - src/.vuepress/dist
+
+
 # this stage creates a new environment for the current branch.
 pages:
   image: docker.gitlab.gwdg.de/mrodzis/docker-images/alpine
-- 
GitLab