From 0dbe76be571184f7c05ebbfa80259d932f98b42c Mon Sep 17 00:00:00 2001 From: ktyl Date: Sat, 9 Apr 2022 23:42:22 +0100 Subject: [PATCH] add deploy script --- deploy.sh | 14 ++++++++++---- makefile | 12 +++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/deploy.sh b/deploy.sh index 48127c2..1b427df 100644 --- a/deploy.sh +++ b/deploy.sh @@ -4,12 +4,18 @@ site=period3.xyz gemini=/home/gemini/gemini dest="$gemini/content" -sudo rm -r $dest/* -sudo mv $site/* $dest +# remove existing files +sudo rm -rv $dest/* -rm -r $site +# copy received files to hosting location +sudo rsync -rvP $site/* $dest -printf "\n\tdone!\n\n" +# clean up +rm -rv $site +# delete self +rm deploy.sh + +printf "\ndone!" diff --git a/makefile b/makefile index df9cf1a..50b0899 100644 --- a/makefile +++ b/makefile @@ -1,4 +1,4 @@ -.DEFAULT_GOAL := site +.DEFAULT_GOAL := $(SITE) SITE = period3.xyz @@ -8,15 +8,17 @@ HOST_DIR = $(HOST):~ CONTENT = content/ DEPLOY = deploy.sh -site: $(SITE) - +# $(SITE): $(CONTENT) [ -d $(SITE) ] || rsync -rP $(CONTENT) $(SITE) -deploy: site +# to deploy the site we copy a deploy script and the site +# contents over to the remote host, then run the deploy script +# which is used to place the site files in the hosted root folder +deploy: $(SITE) rsync -P $(DEPLOY) $(HOST_DIR) rsync -rP $(SITE) $(HOST_DIR) ssh $(HOST) "bash -s" < $(DEPLOY) -clean: +clean: $(SITE) rm -r $(SITE)