Commit 42a8838ea3

42a8838ea369aa5111ae125b3a99511283094b9c

parent: 0a511db18c

Unsigned

cmc <hello@cleberg.net> · 2024-11-22 17:21 UTC

update build script

Layout: unified · split

build.sh +34 −13
@@ -1,34 +1,55 @@
11#!/bin/bash
22
3# Ensure the latest post is included on the home page
34printf "Did you update the 'Recent Blog Posts' section? [yn] "
45read answer
56
7# Only continue if latest post is included on the home page
68if [[ "$answer" =~ ^[Yy]$ ]]; then
7 printf "Publishing on remote or LAN? [r|l] "
8 read method
9
10 if [[ "$method" =~ ^[Rr]$ ]]; then
11 ubuntu_server="ubuntu-remote"
12 elif [[ "$method" =~ ^[Ll]$ ]]; then
13 ubuntu_server="ubuntu"
14 else
15 echo "Invalid input. Assuming LAN (ubuntu)"
16 ubuntu_server="ubuntu"
17 fi
18
9 # Check if the environment flag is set to PROD
1910 if [[ "$ENV" == "prod" ]]; then
2011 echo "Environment: Production"
12
13 # Check if publishing via LAN or remotely
14 printf "Publishing on remote or LAN? [r|l] "
15
16 # Update ubuntu_server variable based on answer
17 read method
18 if [[ "$method" =~ ^[Rr]$ ]]; then
19 ubuntu_server="ubuntu-remote"
20 elif [[ "$method" =~ ^[Ll]$ ]]; then
21 ubuntu_server="ubuntu"
22 else
23 echo "Invalid input. Assuming LAN (ubuntu)"
24 ubuntu_server="ubuntu"
25 fi
26
27 # Remove previous build
2128 rm -rf .build/*
29
30 # Run publishing script
2231 emacs --script publish.el &>/dev/null
32
33 # Minify CSS
2334 minify -o theme/static/styles.min.css theme/static/styles.css
35
36 # Deploy changes
2437 rsync -r --delete-before .build/* $ubuntu_server:/var/www/cleberg.net/
2538 else
2639 echo "Environment: Development"
40
41 # Remove previous build
2742 rm -rf .build/*
43
44 # Run publishing script
2845 emacs --script publish.el
46
47 # Minify CSS
2948 minify -o theme/static/styles.min.css theme/static/styles.css
49
50 # Launch development web server
3051 cd .build/
31 python3 -m http.server
52 python3 -m http.server
3253 fi
3354else
3455 echo "Please update the 'Recent Blog Posts' section before publishing!"