summaryrefslogtreecommitdiff
path: root/deploy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..7d55636
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ ! -f hugo.toml ]; then
+ echo "Must be run in hugo base directory... Exiting."
+ exit 1
+fi
+
+if [ "$(git status --porcelain | wc -l)" -gt 0 ]; then
+ echo "There are uncommited changes... Exiting."
+ exit 1
+fi
+
+if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
+ echo "Not on branch master... Exiting."
+ exit 1
+fi
+
+if [ -d public/ ]; then
+ echo "Cleaning old build."
+ rm -r public/
+fi
+
+echo "Deploying site..."
+hugo && rsync -avz --delete --exclude=git/ public/ www@josephhand.space:/srv/html/josephhand.space/