Commit 258f58a9b3
Unregistered key
Layout: unified · split
.github/workflows/deploy.yml +5 −1
| @@ -17,9 +17,13 @@ jobs: | ||
| 17 | 17 | uses: actions/checkout@v4 |
| 18 | 18 | |
| 19 | 19 | - name: Run Build |
| 20 | env: | |
| 21 | ENV: "prod" | |
| 22 | BUILD: "true" | |
| 23 | DEPLOY: "false" | |
| 20 | 24 | run: | |
| 21 | 25 | echo "Environment is ready. Running build..." |
| 22 | echo "r" | ENV=prod uv run build.py | |
| 26 | uv run build.py | |
| 23 | 27 | |
| 24 | 28 | - name: Upload Build Artifacts |
| 25 | 29 | uses: actions/upload-artifact@v4 |
build.py +14 −38
| @@ -249,8 +249,8 @@ def run_emacs_publish(dev_mode=True): | ||
| 249 | 249 | print("Running Emacs publish script (production)...") |
| 250 | 250 | result = subprocess.run( |
| 251 | 251 | ["emacs", "--script", "publish.el"], |
| 252 | stdout=subprocess.PIPE, | |
| 253 | stderr=subprocess.PIPE, | |
| 252 | stdout=subprocess.DEVNULL, | |
| 253 | stderr=subprocess.DEVNULL, | |
| 254 | 254 | text=True, |
| 255 | 255 | ) |
| 256 | 256 | |
| @@ -346,56 +346,32 @@ def main(): | ||
| 346 | 346 | css_min = theme_dir / "styles.min.css" |
| 347 | 347 | |
| 348 | 348 | env = os.environ.get("ENV", "").casefold() |
| 349 | build = os.environ.get("BUILD", "").casefold() == "true" | |
| 349 | 350 | deploy = os.environ.get("DEPLOY", "").casefold() == "true" |
| 350 | 351 | |
| 351 | if deploy: | |
| 352 | print("Deploying to production...") | |
| 353 | deploy_to_server(build_dir, "homelab-remote") | |
| 354 | return | |
| 355 | else: | |
| 356 | if env == "prod": | |
| 357 | print("Environment: Production") | |
| 358 | ||
| 359 | # Remove previous build | |
| 352 | if env == "prod": | |
| 353 | print("Environment: Production") | |
| 354 | if build: | |
| 360 | 355 | remove_build_directory(build_dir) |
| 361 | ||
| 362 | # Minify CSS | |
| 363 | 356 | minify_css(css_src, css_min) |
| 364 | ||
| 365 | # Run publishing script (silenced output) | |
| 366 | 357 | run_emacs_publish(dev_mode=False) |
| 367 | ||
| 368 | # Update index page with latest posts | |
| 369 | 358 | update_index_html(html_snippet) |
| 370 | ||
| 371 | # Minify index page | |
| 372 | 359 | minify_html("./.build/index.html", "./.build/index.html") |
| 373 | ||
| 374 | # Generate sitemap | |
| 375 | 360 | generate_sitemap() |
| 376 | ||
| 377 | else: | |
| 378 | print("Environment: Development") | |
| 379 | ||
| 380 | # Remove previous build | |
| 361 | if deploy: | |
| 362 | print("Deploying to production...") | |
| 363 | deploy_to_server(build_dir, "homelab-remote") | |
| 364 | return | |
| 365 | else: | |
| 366 | print("Environment: Development") | |
| 367 | if build: | |
| 381 | 368 | remove_build_directory(build_dir) |
| 382 | ||
| 383 | # Minify CSS | |
| 384 | 369 | minify_css(css_src, css_min) |
| 385 | ||
| 386 | # Run publishing script (with console output) | |
| 387 | 370 | run_emacs_publish(dev_mode=True) |
| 388 | ||
| 389 | # Update index page with latest posts | |
| 390 | 371 | update_index_html(html_snippet) |
| 391 | ||
| 392 | # Minify index page | |
| 393 | 372 | minify_html("./.build/index.html", "./.build/index.html") |
| 394 | ||
| 395 | # Generate sitemap | |
| 396 | 373 | generate_sitemap() |
| 397 | ||
| 398 | # Launch development web server | |
| 374 | if deploy: | |
| 399 | 375 | start_dev_server(build_dir) |
| 400 | 376 | |
| 401 | 377 | |