summaryrefslogtreecommitdiff
path: root/.local/bin/upsite
blob: 5b15d21cf9a7b94c06284dcf209cb22f6849f442 (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
#!/bin/sh

username="master"
url="chausse.xyz"
siteroot="$HOME/Workspace/$url"

case "$1" in
  -d|--dev)
    url="dev.$url"
    destdir="/var/www/dev"
    branch="master"
    ;;
  -m|--main)
    destdir="/var/www/chausse"
    branch="construction"
    ;;
  *)
    echo "Usage: upsite [dev|main]"
    exit 1
    ;;
esac

cd "$siteroot" || exit 1
git checkout $branch
git pull
hugo --gc=true --minify
rsync -aucz --delete --progress "$siteroot/public/" "$username@$url:$destdir"