From 5e2019180b8cf66a5f97219829740cf166a6a8ca Mon Sep 17 00:00:00 2001
From: Karel van Klink <karel.vanklink@geant.org>
Date: Thu, 13 Jul 2023 17:13:20 +0200
Subject: [PATCH] add publishing steps for both prod VMs

Signed-off-by: Karel van Klink <karel.vanklink@geant.org>
---
 docs/.gitlab-ci.yml | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/docs/.gitlab-ci.yml b/docs/.gitlab-ci.yml
index b2a226e..8525448 100644
--- a/docs/.gitlab-ci.yml
+++ b/docs/.gitlab-ci.yml
@@ -31,7 +31,7 @@ lint-documentation:
   tags:
     - docker-executor
   needs:
-    - job: build-documentation # Only run when documentation has been built
+    - job: build-documentation  # Only run when documentation has been built
       artifacts: true
 
   before_script:
@@ -40,3 +40,37 @@ lint-documentation:
 
   script:
     - vale $CI_PROJECT_DIR/docs/build/html/_sources
+
+##### Publish documentation artefacts
+publish-documentation-1:
+  stage: documentation
+  # First deploy to prod-2
+  tags:
+    - gap-docs-prod-2
+
+  only:
+    refs:
+      - main  # Only publish when on the main branch
+  needs:
+    - job: lint-documentation  # ... and after it has passed the linting pipeline
+      artifacts: true
+
+  script:
+    - rm -r /var/www/gap-docs/*
+    - mv $CI_PROJECT_DIR/docs/build/html/* /var/www/gap-docs/
+    - nginx -s reload
+
+publish-documentation-2:
+  stage: documentation
+  # When successful, also deploy to prod-1
+  tags:
+    - gap-docs-prod-1
+
+  needs:
+    - job: publish-documentation-1  # Only run when publishing to prod-2 was successful
+      artifacts: true
+
+  script:
+    - rm -r /var/www/gap-docs/*
+    - mv $CI_PROJECT_DIR/docs/build/html/* /var/www/gap-docs/
+    - nginx -s reload
-- 
GitLab