summaryrefslogtreecommitdiffstats
path: root/deploy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..8f7fa52
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,29 @@
+#!/bin/ksh
+
+set -e
+
+if [ -f .env ]; then
+ . ./.env
+else
+ echo ".env file not found"
+ exit 1
+fi
+
+SSH_CMD="ssh -t -i $SSH_KEY $SERVER_USER@$SERVER_IP"
+
+echo "Building Jekyll site..."
+JEKYLL_ENV=production bundle exec jekyll build
+
+echo "Running indexer..."
+(cd cgi-bin && perl indexer.pl)
+
+echo "Running remote presh..."
+$SSH_CMD "doas $REMOTE_PATH/presh"
+
+echo "Syncing files..."
+rsync --rsync-path=openrsync -a --delete -e "ssh -i $SSH_KEY" $HOME/www/_site/ $SERVER_USER@$SERVER_IP:$REMOTE_PATH/$SITE
+
+echo "Running remote sh..."
+$SSH_CMD "doas $REMOTE_PATH/sh"
+
+echo "Deployment complete"