add deploy script

This commit is contained in:
ktyl 2022-04-09 23:42:22 +01:00
parent 0cb7226a23
commit 0dbe76be57
2 changed files with 17 additions and 9 deletions

View File

@ -4,12 +4,18 @@ site=period3.xyz
gemini=/home/gemini/gemini gemini=/home/gemini/gemini
dest="$gemini/content" dest="$gemini/content"
sudo rm -r $dest/* # remove existing files
sudo mv $site/* $dest 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!"

View File

@ -1,4 +1,4 @@
.DEFAULT_GOAL := site .DEFAULT_GOAL := $(SITE)
SITE = period3.xyz SITE = period3.xyz
@ -8,15 +8,17 @@ HOST_DIR = $(HOST):~
CONTENT = content/ CONTENT = content/
DEPLOY = deploy.sh DEPLOY = deploy.sh
site: $(SITE) #
$(SITE): $(CONTENT) $(SITE): $(CONTENT)
[ -d $(SITE) ] || rsync -rP $(CONTENT) $(SITE) [ -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 -P $(DEPLOY) $(HOST_DIR)
rsync -rP $(SITE) $(HOST_DIR) rsync -rP $(SITE) $(HOST_DIR)
ssh $(HOST) "bash -s" < $(DEPLOY) ssh $(HOST) "bash -s" < $(DEPLOY)
clean: clean: $(SITE)
rm -r $(SITE) rm -r $(SITE)