aboutsummaryrefslogtreecommitdiff
path: root/utils/hooks/post-push
blob: 41930378a3b0e0e7995f945b56790ced4120941a (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
# .git/hooks/post-push
#!/bin/bash
echo "Environment: Production"

# Check if publishing via LAN or remotely
printf "Publishing on remote or LAN? [r|l] "

# Update ubuntu_server variable based on answer
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

# Remove previous build
rm -rf .build/*

# Run publishing script
emacs --script publish.el &>/dev/null

# Minify CSS
minify -o theme/static/styles.min.css theme/static/styles.css

# Deploy changes
rsync -r --delete-before .build/* $ubuntu_server:/var/www/cleberg.net/