summaryrefslogtreecommitdiffstats
path: root/deploy.sh
blob: 8f7fa5204a3968cbe818130bdcf9f9785e631a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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"