diff options
author | Christian Cleberg <hello@cleberg.net> | 2024-11-22 11:21:22 -0600 |
---|---|---|
committer | Christian Cleberg <hello@cleberg.net> | 2024-11-22 11:21:22 -0600 |
commit | ebbf09dcead72218ad0acfec0b1e0cf92ec5bc61 (patch) | |
tree | f8babf97b56a9e7fef040a595ff8f1967a9d76e5 | |
parent | b7d5d741a33657dbad4b2c55ad63a897951ee1e4 (diff) | |
download | cleberg.net-ebbf09dcead72218ad0acfec0b1e0cf92ec5bc61.tar.gz cleberg.net-ebbf09dcead72218ad0acfec0b1e0cf92ec5bc61.tar.bz2 cleberg.net-ebbf09dcead72218ad0acfec0b1e0cf92ec5bc61.zip |
update build script
-rwxr-xr-x | build.sh | 47 |
1 files changed, 34 insertions, 13 deletions
@@ -1,34 +1,55 @@ #!/bin/bash +# Ensure the latest post is included on the home page printf "Did you update the 'Recent Blog Posts' section? [yn] " read answer +# Only continue if latest post is included on the home page 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 - + # Check if the environment flag is set to PROD if [[ "$ENV" == "prod" ]]; then 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/ else echo "Environment: Development" + + # Remove previous build rm -rf .build/* + + # Run publishing script emacs --script publish.el + + # Minify CSS minify -o theme/static/styles.min.css theme/static/styles.css + + # Launch development web server cd .build/ - python3 -m http.server + python3 -m http.server fi else echo "Please update the 'Recent Blog Posts' section before publishing!" |