From d8c30fa3461bf321d0f88d2991eeff7a41a11e48 Mon Sep 17 00:00:00 2001
From: "Yung-Lin Huang (Cary)" <carydog@gmail.com>
Date: Thu, 5 Nov 2020 15:40:24 +0100
Subject: [PATCH] Restructured Gitlab CI files.

---
 .gitlab-ci.yml                   | 53 ++------------------------------
 .gitlab/ci/pdf.gitlab-ci.yml     | 34 ++++++++++++++++++++
 .gitlab/ci/release.gitlab-ci.yml | 15 +++++++++
 3 files changed, 52 insertions(+), 50 deletions(-)
 create mode 100644 .gitlab/ci/pdf.gitlab-ci.yml
 create mode 100644 .gitlab/ci/release.gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c1428a0..9101fa8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,53 +18,6 @@ variables:
     Meshalyzer is a graphical program for display time dependent data on 3D finite elment meshes. <br>
     Find the changelog [here](https://git.opencarp.org/openCARP/meshalyzer/blob/master/CHANGELOG.md).
                               
-build-pdf-manual:
-  stage: build
-  image: $PDF_MANUAL_MAKER_IMAGE
-  script:
-    - cd manual && pdflatex manual && pdflatex manual
-  artifacts:
-    paths:
-      - manual/manual.pdf
-    expire_in: 2 hour
-
-release-pdf-manual:
-  stage: release
-  image: ubuntu:18.04
-  dependencies:
-  - build-pdf-manual
-  only:
-  - master
-  - tags
-  before_script:
-  # setup rsync
-  - apt-get update && apt-get install -y openssh-client rsync
-  - eval $(ssh-agent -s)
-  - mkdir -p ~/.ssh
-  - chmod 700 ~/.ssh
-  - echo "$SSH_PRIVATE_KEY" | base64 -d | ssh-add -
-  - ssh-keyscan -H sulmass.scc.kit.edu > ~/.ssh/known_hosts
-  script:
-  - cp manual/manual.pdf $PDF_MANUAL
-  - "rsync -av --delete $PDF_MANUAL $PDF_MANUAL_DESTINATION/"
-  - >
-    if [ "$CI_COMMIT_TAG" != "" ]; then
-      cp manual/manual.pdf $PDF_MANUAL_RELEASE &&
-      rsync -av --delete $PDF_MANUAL_RELEASE $PDF_MANUAL_DESTINATION/
-    fi
-
-release-create:
-  stage: release
-  image: python:3.7
-  only:
-  - tags
-  except:
-  - branches
-  before_script:
-  # setup pipelines
-  - git clone https://opencarp-admin:${PRIVATE_TOKEN}@git.opencarp.org/infrastructure/pipelines.git
-  - pip install -r pipelines/requirements.txt
-  script:
-  - >
-    python pipelines/scripts/create_release.py
-    $PDF_MANUAL_RELEASE_URL
+include:
+- local: .gitlab/ci/pdf.gitlab-ci.yml
+- local: .gitlab/ci/release.gitlab-ci.yml
diff --git a/.gitlab/ci/pdf.gitlab-ci.yml b/.gitlab/ci/pdf.gitlab-ci.yml
new file mode 100644
index 0000000..db4e4cb
--- /dev/null
+++ b/.gitlab/ci/pdf.gitlab-ci.yml
@@ -0,0 +1,34 @@
+build-pdf-manual:
+  stage: build
+  image: $PDF_MANUAL_MAKER_IMAGE
+  script:
+    - cd manual && pdflatex manual && pdflatex manual
+  artifacts:
+    paths:
+      - manual/manual.pdf
+    expire_in: 2 hour
+
+release-pdf-manual:
+  stage: release
+  image: ubuntu:18.04
+  dependencies:
+  - build-pdf-manual
+  only:
+  - master
+  - tags
+  before_script:
+  # setup rsync
+  - apt-get update && apt-get install -y openssh-client rsync
+  - eval $(ssh-agent -s)
+  - mkdir -p ~/.ssh
+  - chmod 700 ~/.ssh
+  - echo "$SSH_PRIVATE_KEY" | base64 -d | ssh-add -
+  - ssh-keyscan -H sulmass.scc.kit.edu > ~/.ssh/known_hosts
+  script:
+  - cp manual/manual.pdf $PDF_MANUAL
+  - "rsync -av --delete $PDF_MANUAL $PDF_MANUAL_DESTINATION/"
+  - >
+    if [ "$CI_COMMIT_TAG" != "" ]; then
+      cp manual/manual.pdf $PDF_MANUAL_RELEASE &&
+      rsync -av --delete $PDF_MANUAL_RELEASE $PDF_MANUAL_DESTINATION/
+    fi
diff --git a/.gitlab/ci/release.gitlab-ci.yml b/.gitlab/ci/release.gitlab-ci.yml
new file mode 100644
index 0000000..c30a645
--- /dev/null
+++ b/.gitlab/ci/release.gitlab-ci.yml
@@ -0,0 +1,15 @@
+release-create:
+  stage: release
+  image: python:3.7
+  only:
+  - tags
+  except:
+  - branches
+  before_script:
+  # setup pipelines
+  - git clone https://opencarp-admin:${PRIVATE_TOKEN}@git.opencarp.org/infrastructure/pipelines.git
+  - pip install -r pipelines/requirements.txt
+  script:
+  - >
+    python pipelines/scripts/create_release.py
+    $PDF_MANUAL_RELEASE_URL
-- 
GitLab