-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·51 lines (42 loc) · 1.29 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·51 lines (42 loc) · 1.29 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# This script deploys a Hugo website to the specified server
# via SSH. SSH keys are assumed to be already configured and
# active.
# Just run it without arguments and it will do its thing.
clean_deploy=false
# colon after var means it has a value rather than it being a bool flag
while getopts 'c' OPTION; do
case "$OPTION" in
c)
clean_deploy=true
;;
?)
echo "Script usage: $(basename $0) [-c]" >&2
exit -1
;;
esac
done
# the local hugo build directory.
build_directory="./public/"
# the ssh server name.
# please, add an entry with the given name to ~/.ssh/config
# Host nfs
# HostName ssh.phx.nearlyfreespeech.net
# TCPKeepAlive yes
# ServerAliveInterval 300
# User langurmonkey_tonisagristacom
ssh_server="nfs"
# the public directory in the server where the site is.
server_dir="/home/public"
# stats update script in the server
stats_update="/home/tmp/updatestats"
# DEPLOY
echo "## Deploying site to ${ssh_server}:${server_dir}."
flags=""
if [ ${clean_deploy} = true ]; then
flags="--delete"
fi
echo "## Copying data to server."
# copy contents of ${build_directory} to server
rsync -avh --cvs-exclude ${flags} ${build_directory}/ ${ssh_server}:${server_dir}/
echo "## Finished deploying site to ${ssh_server}:${server_dir}."