Permalink
Browse files

Add deploy scripts for static site. To be triggered by a Post-Receive…

… URL hook on GitHub.
  • Loading branch information...
1 parent d640421 commit a9349f9c70bbf3b59d68e2f360c113d843cf03a3 @jasoncodes committed Jan 2, 2010
Showing with 31 additions and 0 deletions.
  1. +3 −0 .htaccess
  2. +5 −0 _deploy.php
  3. +23 −0 _deploy.sh
View
@@ -14,3 +14,6 @@ AddType font/ttf ttf
AddType font/otf otf
AddType application/vnd.ms-fontobject eot
AddType image/vnd.microsoft.icon ico
+
+Options +MultiViews
+DirectorySlash off
View
@@ -0,0 +1,5 @@
+<?php
+header('Content-Type: text/plain');
+umask(0022);
+passthru('chmod +x _deploy.sh');
+passthru('./_deploy.sh 2>&1');
View
@@ -0,0 +1,23 @@
+#!/bin/bash -e
+if [ ! -d .git ]
+then
+ echo Content-Type: text/plain
+ echo
+ cd ../repo
+ git fetch origin
+ git reset -q --hard origin/master
+ git clean -qxf
+ chmod +x _deploy.sh
+ ./_deploy.sh
+else
+ cd ..
+ [ -e public_html.tmp ] && rm -rf public_html.tmp
+ (cd repo && git checkout-index --all --prefix=../public_html.tmp/)
+ [ -e public_html.new ] && rm -rf public_html.new
+ rsync --archive public_html/ public_html.new
+ rsync -rlpgoDO --checksum --delete public_html.tmp/ public_html.new/
+ rm -rf public_html.tmp
+ [ -e public_html.old ] && rm -rf public_html.old
+ mv public_html{,.old}
+ mv public_html{.new,}
+fi

0 comments on commit a9349f9

Please sign in to comment.