#! /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 . 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