diff options
| author | Christian Cleberg <[email protected]> | 2026-02-12 00:57:28 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-12 00:57:28 -0600 |
| commit | 258f58a9b334eda782f4ea279638af27e39ffea9 (patch) | |
| tree | 7c4f4da3706088dcb28c0f4a947e12a606850f29 /build.py | |
| parent | fc8a4e57555ac0064a85c0598ccf20a5bda38e9d (diff) | |
| download | cleberg.net-258f58a9b334eda782f4ea279638af27e39ffea9.tar.gz cleberg.net-258f58a9b334eda782f4ea279638af27e39ffea9.tar.bz2 cleberg.net-258f58a9b334eda782f4ea279638af27e39ffea9.zip | |
clean up build, deploy, and env options (#2)
Diffstat (limited to 'build.py')
| -rw-r--r-- | build.py | 52 |
1 files changed, 14 insertions, 38 deletions
@@ -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) |
