summaryrefslogtreecommitdiff
path: root/deploy.sh
blob: 7d556366008cbe17fb6bc9d03f2818ce00eadb6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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/