From 303856158b052715367248c9a868c7fd7defb197 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Fri, 2 Oct 2015 12:03:29 +0200 Subject: Make deploy script a bit better. --- .gitignore | 1 + deploy.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d7d3aa1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +deploy_*.rc diff --git a/deploy.sh b/deploy.sh index 4e9436c..a0b8f29 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,2 +1,58 @@ #! /bin/bash -scp -r blog/_site/* volse.anduin.net:/usr/local/www/norsk-urskog/beta +# +# 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:" +pushd blog +jekyll build +buildres=$? +popd + +source "deploy_$target.rc" + +if [[ $buildres == 0 ]]; +then + echo "** Deploying to: $deploy_to_path" + scp -r blog/_site/* $deploy_to_path +fi -- cgit v1.2.3