Pi66

pi66.xyz
My personal website.
git clone https://git.pi66.xyz/pi66.xyz

← back to log

feat: sync static files on release

author: pi66
date: 2026-08-13 17:23
hash: dcb1730f8b39039181c8048798c84c45af6b2910

Diffstat:

M

src/plugins/main.py
14 ++++++++++++++++++++++++++++++
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/src/plugins/main.py b/src/plugins/main.py
index 9b7e75c..7f313c7 100644
--- a/src/plugins/main.py
+++ b/src/plugins/main.py
@@ -1,4 +1,18 @@
 from json import loads
+import subprocess, os
+
+@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}")

 about = loads(open("./src/data/about.json", "r").read())