diff options
author | Christian Cleberg <hello@cleberg.net> | 2025-01-24 20:26:20 -0600 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2025-01-24 20:26:20 -0600 |
commit | dbcec87682afbb2d2bcb3fbeb397a94441a1f8cd (patch) | |
tree | 1667b7286fab00f5a12d0dff04088ba1d0e41ffc /utils/hooks/post-push | |
parent | 927eefd776aaf6dc89dd6b120303104eb52d5c38 (diff) | |
download | cleberg.net-dbcec87682afbb2d2bcb3fbeb397a94441a1f8cd.tar.gz cleberg.net-dbcec87682afbb2d2bcb3fbeb397a94441a1f8cd.tar.bz2 cleberg.net-dbcec87682afbb2d2bcb3fbeb397a94441a1f8cd.zip |
add more git hooks
Diffstat (limited to 'utils/hooks/post-push')
-rw-r--r-- | utils/hooks/post-push | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/utils/hooks/post-push b/utils/hooks/post-push new file mode 100644 index 0000000..4193037 --- /dev/null +++ b/utils/hooks/post-push @@ -0,0 +1,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/ |