summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Cole <dave@developmentseed.org>2013-04-11 15:33:58 -0400
committerDave Cole <dave@developmentseed.org>2013-04-11 15:33:58 -0400
commit0a0cf89dc654dd50dac3f8a745bab5505ab66dae (patch)
tree1a4cc16988b41b36563bfc46fb17342d541bfb6e
parent1f4b487caa217758245c6fbc819d001e61ac22cc (diff)
Add publish-s3 script. Don't try to override baseurl in publish script.
-rwxr-xr-xscripts/build.sh2
-rwxr-xr-xscripts/publish-s3.sh37
2 files changed, 38 insertions, 1 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index f92e77a..4d689db 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -25,5 +25,5 @@ cd -
# Run jekyll
cd $source
-jekyll $source $build --no-server --no-auto -base-url="/$repo"
+jekyll $source $build --no-server --no-auto
cd -
diff --git a/scripts/publish-s3.sh b/scripts/publish-s3.sh
new file mode 100755
index 0000000..698424a
--- /dev/null
+++ b/scripts/publish-s3.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -e
+
+# This script is meant to be run automatically
+# as part of the jekyll-hook application.
+# https://github.com/developmentseed/jekyll-hook
+
+repo=$1
+branch=$2
+owner=$3
+giturl=$4
+source=$5
+build=$6
+
+# S3 bucket
+bucket=developmentseed.org.jekyll-hook
+
+if [[ "$repo" == *.github.* ]]
+then
+
+ # get list of sites
+ excludes=$(s3cmd ls s3://$bucket/_sites/|awk -F\/ 'BEGIN{ORS=" ";} {print "--exclude '\''" $NF "/*'\''"}')
+
+ # if root repo, sync --exclude _sites & sites
+ eval "s3cmd sync --delete-removed --exclude '_sites/*' $excludes $build/ s3://$bucket/"
+
+else
+
+ # add repo name to _sites
+ touch /tmp/$repo
+ s3cmd put /tmp/$repo s3://$bucket/_sites/
+ rm /tmp/$repo
+
+ # if not root repo, sync to subdirectory
+ s3cmd sync --delete-removed $build/ s3://$bucket/$repo/
+
+fi