cmc/cleberg.net

My personal web garden & blog.

clone: git clone https://gitbay.org/cmc/cleberg.net.git

258f58a9b334eda782f4ea279638af27e39ffea9

signed_unknown_key

author: Christian Cleberg <hello@cleberg.net> · 2026-02-12T06:57:28Z
committer: <noreply@github.com>

clean up build, deploy, and env options (#2)

 .github/workflows/deploy.yml |  6 ++++-
 build.py                     | 52 ++++++++++++--------------------------------
 2 files changed, 19 insertions(+), 39 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 85eeff7..012ff16 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -17,9 +17,13 @@ jobs:
         uses: actions/checkout@v4
 
       - name: Run Build
+        env:
+          ENV: "prod"
+          BUILD: "true"
+          DEPLOY: "false"
         run: |
           echo "Environment is ready. Running build..."
-          echo "r" | ENV=prod uv run build.py
+          uv run build.py
 
       - name: Upload Build Artifacts
         uses: actions/upload-artifact@v4
diff --git a/build.py b/build.py
index 44b77d0..940acad 100644
--- a/build.py
+++ b/build.py
@@ -249,8 +249,8 @@ def run_emacs_publish(dev_mode=True):
         print("Running Emacs publish script (production)...")
         result = subprocess.run(
             ["emacs", "--script", "publish.el"],
-            stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE,
+            stdout=subprocess.DEVNULL,
+            stderr=subprocess.DEVNULL,
             text=True,
         )
 
@@ -346,56 +346,32 @@ def main():
     css_min = theme_dir / "styles.min.css"
 
     env = os.environ.get("ENV", "").casefold()
+    build = os.environ.get("BUILD", "").casefold() == "true"
     deploy = os.environ.get("DEPLOY", "").casefold() == "true"
 
-    if deploy:
-        print("Deploying to production...")
-        deploy_to_server(build_dir, "homelab-remote")
-        return
-    else:
-        if env == "prod":
-            print("Environment: Production")
-
-            # Remove previous build
+    if env == "prod":
+        print("Environment: Production")
+        if build:
             remove_build_directory(build_dir)
-
-            # Minify CSS
             minify_css(css_src, css_min)
-
-            # Run publishing script (silenced output)
             run_emacs_publish(dev_mode=False)
-
-            # Update index page with latest posts
             update_index_html(html_snippet)
-
-            # Minify index page
             minify_html("./.build/index.html", "./.build/index.html")
-
-            # Generate sitemap
             generate_sitemap()
-
-        else:
-            print("Environment: Development")
-
-            # Remove previous build
+        if deploy:
+            print("Deploying to production...")
+            deploy_to_server(build_dir, "homelab-remote")
+            return
+    else:
+        print("Environment: Development")
+        if build:
             remove_build_directory(build_dir)
-
-            # Minify CSS
             minify_css(css_src, css_min)
-
-            # Run publishing script (with console output)
             run_emacs_publish(dev_mode=True)
-
-            # Update index page with latest posts
             update_index_html(html_snippet)
-
-            # Minify index page
             minify_html("./.build/index.html", "./.build/index.html")
-
-            # Generate sitemap
             generate_sitemap()
-
-            # Launch development web server
+        if deploy:
             start_dev_server(build_dir)