aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: 077193d3ad7da4dc59b734969c5b4ba387db9930 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

printf "Did you update the 'Recent Blog Posts' section? [yn] "
read answer

if [[ "$answer" =~ ^[Yy]$ ]]; then
    printf "Publishing on remote or LAN? [r|l] "
    read method
    
    if [[ "$method" =~ ^[Rr]$ ]]; then
        ubuntu_server="ubuntu-remote"
    elif [[ "$method" =~ ^[Ll]$ ]]; then
        ubuntu_server="ubuntu"
    else
        echo "Invalid input. Assuming LAN (ubuntu)"
        ubuntu_server="ubuntu"
    fi
    
    if [[ "$ENV" == "prod" ]]; then
        echo "Environment: Production"
        rm -rf .build/*
        emacs --script publish.el &>/dev/null
        minify -o theme/static/styles.min.css theme/static/styles.css
        rsync -r --delete-before .build/* $ubuntu_server:/var/www/cleberg.net/
    else
        echo "Environment: Development"
        rm -rf .build/*
        emacs --script publish.el
        minify -o theme/static/styles.min.css theme/static/styles.css
        cd .build/
            python3 -m http.server
    fi
else
    echo "Please update the 'Recent Blog Posts' section before publishing!"
fi