From 8e8a4fe9800e18178cac3b74bde9ee01362c5d71 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 3 Jan 2024 20:00:00 +0000 Subject: [PATCH] Add `publish` task Add a `publish` task to generate a production version of the website and upload it via rsync. --- run | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/run b/run index 01561661..af34d776 100755 --- a/run +++ b/run @@ -4,12 +4,10 @@ set -o nounset set -o pipefail function clean { - rm -fr node_modules/ output_*/ source/build/ vendor/ + rm -fr output_*/ source/build/ } function generate { - rm -rf output_*/ - local args=() if [[ "${APP_ENV:-}" == "production" ]]; then @@ -43,5 +41,21 @@ function npm:build:css { --output source/build/tailwind.css "${args[@]}" } +function publish { + export NODE_ENV=production + export APP_ENV=production + + git stash + + clean + npm:build:css + generate + + rsync --archive --verbose --compress --update --delete \ + output_prod/ ssh.oliverdavies.uk:/srv/oliverdavies.uk-sculpin + + git stash pop +} + TIMEFORMAT="Task completed in %3lR" time "${@:-help}"