Pi66

git.pi66.xyz
A web interface for the pi66.xyz Git server
git clone https://git.pi66.xyz/git.pi66.xyz

← back to log

feat: sync static files on release

author: pi66
date: 2026-08-13 17:53
hash: 68b3db464a9ca33e4ea93d6dc64ddfcb6629211e

Diffstat:

M

src/plugins/main.py
16 ++++++++++++++++++++++++++++--
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/src/plugins/main.py b/src/plugins/main.py
index 9098633..c59811f 100644
--- a/src/plugins/main.py
+++ b/src/plugins/main.py
@@ -1,4 +1,4 @@
-import os
+import subprocess, os
 from git import load_repos
 from log_builder import create_log_pages
 from file_builder import create_file_pages
@@ -20,6 +20,20 @@ def ensure_repos():
         os.path.expanduser(GIT_DIR)
     )

+@hook("on_end")
+def sync_static():
+    if api.mode == "release":
+        try:
+            subprocess.run([
+                "rsync", "-a",
+                api.config.tree.static + "/",
+                os.path.join(os.path.dirname(api.config.tree.release_dest), "static")
+            ])
+            api.log.info("Static files synced successfully.")
+        except Exception as e:
+            api.log.die(f"Failed to sync static files: {e}")
+
+
 @hook("on_build_start")
 def on_start_(_):
     storage.set("repos", ensure_repos())