From 08bed78d5f9f46781f158533aa9d0f77cb1c7b84 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Fri, 1 Nov 2024 16:12:58 -0500 Subject: add deployment option to build script --- build.sh | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/build.sh b/build.sh index 1f71451..077193d 100755 --- a/build.sh +++ b/build.sh @@ -4,20 +4,32 @@ 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:/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 + 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!" + echo "Please update the 'Recent Blog Posts' section before publishing!" fi -- cgit v1.2.3-70-g09d2