about summary refs log tree commit diff
path: root/guix
diff options
context:
space:
mode:
authorArun Isaac2025-11-04 02:38:41 +0000
committerArun Isaac2025-11-04 13:36:48 +0000
commit5ab44479ccb368f50b8fa768a719abd43d189053 (patch)
treeaa6054b52190a01d3aae9ab22f5daee1a756fb65 /guix
parentde8d5a774b96976c0ed3ed529870f89fd1b4a9aa (diff)
downloadguix-forge-5ab44479ccb368f50b8fa768a719abd43d189053.tar.gz
guix-forge-5ab44479ccb368f50b8fa768a719abd43d189053.tar.lz
guix-forge-5ab44479ccb368f50b8fa768a719abd43d189053.zip
forge: Promote website CI job to its own field.
With the website CI job in its own field, we can reduce boilerplate
around installing the built website at the correct path.
Diffstat (limited to 'guix')
-rw-r--r--guix/forge/forge.scm28
1 files changed, 27 insertions, 1 deletions
diff --git a/guix/forge/forge.scm b/guix/forge/forge.scm
index 31728dc..63bc68d 100644
--- a/guix/forge/forge.scm
+++ b/guix/forge/forge.scm
@@ -63,6 +63,7 @@
             forge-project-repository-branch
             forge-project-web-domain
             forge-project-tissue?
+            forge-project-website-ci-job
             forge-project-ci-jobs
             forge-project-ci-jobs-trigger
             forge-project-parallel-ci-job-runs
@@ -91,6 +92,10 @@
               (default #f))
   (tissue? forge-project-tissue?
            (default #f))
+  (website-ci-job forge-project-website-ci-job
+                  ;; TODO: Add default website builder.
+                  (default #f)
+                  (thunked))
   (ci-jobs forge-project-ci-jobs
            (default '()) (thunked))
   (ci-jobs-trigger forge-project-ci-jobs-trigger ; one of 'post-receive-hook, 'cron, 'webhook
@@ -485,6 +490,17 @@ that were built."
                                           (package-channels pkg))))))))
                 inferior))))))))
 
+(define (switch-symlinks-gexp link target)
+  "Return a G-expression that links @var{link} to @var{target}. @var{target} is a
+singleton list of targets as returned by @code{guix-channel-job-gexp}."
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+
+        (switch-symlinks #$link
+                         (match #$target
+                           ((target) target))))))
+
 (define (forge-nginx-server-blocks config)
   "Return list of @code{<nginx-server-configuration>} extensions for
 forge configuration @var{config}."
@@ -548,7 +564,17 @@ value of the returned list is a @code{<forge-laminar-job>} object."
                         (inherit job)
                         (contexts (cons (forge-project-name project)
                                         (forge-laminar-job-contexts job)))))
-                     (forge-project-ci-jobs project)))
+                     ;; Prepend website CI job to the other CI jobs.
+                     (if (forge-project-website-ci-job project)
+                         (cons (forge-laminar-job
+                                (inherit (forge-project-website-ci-job project))
+                                (run (switch-symlinks-gexp
+                                      (string-append (forge-configuration-websites-directory config)
+                                                     "/"
+                                                     (forge-project-name project))
+                                      (forge-laminar-job-run (forge-project-website-ci-job project)))))
+                               (forge-project-ci-jobs project))
+                         (forge-project-ci-jobs project))))
               (forge-configuration-projects config)))
 
 (define (forge-ci-job-contexts config)