From fb75a9b4de5c8376561d423d2b7260ae2dd067e0 Mon Sep 17 00:00:00 2001 From: ktyl Date: Fri, 8 Apr 2022 02:04:03 +0100 Subject: [PATCH] improve deploy script --- .gitignore | 2 ++ deploy.sh | 15 +++++++++++++++ makefile | 26 +++++++++++++++++++++----- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 deploy.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2b68f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# build artifact +period3.xyz diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..48127c2 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +site=period3.xyz +gemini=/home/gemini/gemini +dest="$gemini/content" + +sudo rm -r $dest/* +sudo mv $site/* $dest + +rm -r $site + +printf "\n\tdone!\n\n" + + + diff --git a/makefile b/makefile index 4c2d42f..df9cf1a 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,22 @@ -HOST = pluto -SITE = period3.xyz +.DEFAULT_GOAL := site -deploy: - git push - ssh $(HOST) ./deploy-$(SITE) +SITE = period3.xyz + +HOST = pluto +HOST_DIR = $(HOST):~ + +CONTENT = content/ +DEPLOY = deploy.sh + +site: $(SITE) + +$(SITE): $(CONTENT) + [ -d $(SITE) ] || rsync -rP $(CONTENT) $(SITE) + +deploy: site + rsync -P $(DEPLOY) $(HOST_DIR) + rsync -rP $(SITE) $(HOST_DIR) + ssh $(HOST) "bash -s" < $(DEPLOY) + +clean: + rm -r $(SITE)