summaryrefslogtreecommitdiffstats
path: root/deploy.sh
blob: db92d6d54623557949d94ef51311c2a8033a0564 (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
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
52
53
54
55
56
#! /bin/bash
#
# Deploy site to target server
#
# Usage
# -----
#
# Create a file named "deploy_target.rc" in the same directory where
# this script is located. It should contain the following content:
#
#     deploy_to_path=user@server:/path/to/site
#
# This will be sourced by this script to configure where you want to
# deploy the site.
#
# Deploy using this invocation:
#
#     ./deploy target
#
# Where target is the same as in the file name above. If no target is
# specified, the target "beta" is used by default.
#
# License
# -------
# Copyright (C) 2015  Harald Eilertsen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

target=$1
if [[ -z $target ]];
then
    target="beta"
fi

echo "** Building site:"
bundle exec jekyll build -s blog
buildres=$?

source "deploy_$target.rc"

if [[ $buildres == 0 ]];
then
    echo "** Deploying to: $deploy_to_path"
    rsync -avzz _site/* $deploy_to_path
fi