Add publish task

Add a `publish` task to generate a production version of the website and
upload it via rsync.
This commit is contained in:
Oliver Davies 2024-01-03 20:00:00 +00:00
parent 65a39f6325
commit 8e8a4fe980

20
run
View file

@ -4,12 +4,10 @@ set -o nounset
set -o pipefail set -o pipefail
function clean { function clean {
rm -fr node_modules/ output_*/ source/build/ vendor/ rm -fr output_*/ source/build/
} }
function generate { function generate {
rm -rf output_*/
local args=() local args=()
if [[ "${APP_ENV:-}" == "production" ]]; then if [[ "${APP_ENV:-}" == "production" ]]; then
@ -43,5 +41,21 @@ function npm:build:css {
--output source/build/tailwind.css "${args[@]}" --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" TIMEFORMAT="Task completed in %3lR"
time "${@:-help}" time "${@:-help}"