Commit bcc50c5f12

bcc50c5f12008b397430844f5d019b729d456008

parent: 7438a402ea

Unsigned

cmc <hello@cleberg.net> · 2024-11-01 21:12 UTC

add deployment option to build script

Layout: unified · split

build.sh +26 −14
@@ -4,20 +4,32 @@ printf "Did you update the 'Recent Blog Posts' section? [yn] "
4read answer 4read answer
5 5
6if [[ "$answer" =~ ^[Yy]$ ]]; then 6if [[ "$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
7 if [[ "$ENV" == "prod" ]]; then 19 if [[ "$ENV" == "prod" ]]; then
8 echo "Environment: Production" 20 echo "Environment: Production"
9 rm -rf .build/* 21 rm -rf .build/*
10 emacs --script publish.el &>/dev/null 22 emacs --script publish.el &>/dev/null
11 minify -o theme/static/styles.min.css theme/static/styles.css 23 minify -o theme/static/styles.min.css theme/static/styles.css
12 rsync -r --delete-before .build/* ubuntu:/var/www/cleberg.net/ 24 rsync -r --delete-before .build/* $ubuntu_server:/var/www/cleberg.net/
13 else 25 else
14 echo "Environment: Development" 26 echo "Environment: Development"
15 rm -rf .build/* 27 rm -rf .build/*
16 emacs --script publish.el 28 emacs --script publish.el
17 minify -o theme/static/styles.min.css theme/static/styles.css 29 minify -o theme/static/styles.min.css theme/static/styles.css
18 cd .build/ 30 cd .build/
19 python3 -m http.server 31 python3 -m http.server
20 fi 32 fi
21else 33else
22 echo "Please update the 'Recent Blog Posts' section before publishing!" 34 echo "Please update the 'Recent Blog Posts' section before publishing!"
23fi 35fi