From 69fe1fcfad88facd211d3c0da287ed46bb9f4b2a Mon Sep 17 00:00:00 2001
From: Kristina Mazur <kristina.mazur@tum.de>
Date: Tue, 28 Jan 2025 10:57:13 +0100
Subject: [PATCH] Update pipeline

---
 .gitlab-ci.yml | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f17d36b..943ac59 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,8 +17,38 @@
 # === Configure pipeline ===
 # This section defines the stages of the pipeline: build and deploy
 stages:
+  - build   # The 'build' stage is where documents are copied to the PROJECT_DIR
   - deploy  # The 'deploy' stage generates and deploys the generated documentation.
 
+# === Clone the repositories / copy documentation to the  PROJECT_DIR ===
+clone:
+  image: alpine:latest
+  stage: build  # This job is part of the build stage
+  tags:
+    - documentation  # Label for the job to be picked up by appropriate runners
+  before_script:
+  # Install necessary packages, including git, doxygen, and other dependencies
+    - apk update && apk --no-cache add git doxygen graphviz ttf-freefont texmf-dist texmf-dist-latexextra texlive texlive-dvi
+  script:
+      # clone repos
+      - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@git.rwth-aachen.de/unicado/aircraft-design
+      - cd aircraft-design
+      - git clone --recurse-submodules https://gitlab-ci-token:${CI_JOB_TOKEN}@git.rwth-aachen.de/unicado/libraries libs/
+    # Change to the project directory (useful for multi-directory repositories)
+      - cd $CI_PROJECT_DIR
+      - ls -la $CI_PROJECT_DIR
+  artifacts:
+    # Save the generated documentation as artifacts so they can be accessed later in the pipeline
+    paths:
+      - $CI_PROJECT_DIR/aircraft-design
+  rules:
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'  # Run when the commit is on the default branch
+      when: on_success  # Only run if the previous jobs are successful
+    - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'  # Allow manual triggers on non-default branches
+      when: manual  # Run only when triggered manually
+    - if: '$CI_PIPELINE_SOURCE == "trigger"'  # Triggered by another pipeline
+      when: on_success  # Run if the source pipeline was successful
+
 # === Build and deploy the website ===
 pages:
   image: python:latest
-- 
GitLab