From e8c0ef556cef4a99edf5ab4f2dddd2c8ca760ba2 Mon Sep 17 00:00:00 2001
From: Bastien Abadie <abadie@teklia.com>
Date: Tue, 16 Apr 2024 14:15:53 +0000
Subject: [PATCH] Build with drafts for surge

---
 .gitlab-ci.yml | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f2babfe0..73149771 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,7 +22,7 @@ pre-commit:
   script:
     - pre-commit run -a
 
-build:
+.build:
   image: alpine:3.15
   stage: build
 
@@ -34,9 +34,29 @@ build:
     - apk add --update zola git
     - git submodule update --init
 
+build-drafts:
+  extends: .build
+
+  script:
+    - zola build --base-url=/ --drafts
+
+  only:
+    - branches
+    - tags
+
+  except:
+    - master
+
+
+build-production:
+  extends: .build
+
   script:
     - zola build --base-url=/
 
+  only:
+    - master
+
 pages:
   image: alpine
   stage: deploy
@@ -48,6 +68,9 @@ pages:
   only:
     - master
 
+  dependencies:
+    - build-production
+
   script:
     # Gitlab exposes files from the public folder at the root of the project
     - 'true'
@@ -60,6 +83,8 @@ pages:
     - branches
   except:
     - master
+  dependencies:
+    - build-drafts
 
   environment:
     name: ${CI_COMMIT_REF_SLUG}
-- 
GitLab