aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-11-14 10:45:27 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-11-14 10:45:27 -0200
commit1148ec488e42984a32a3221662171ebc35c3edf9 (patch)
tree9501d79cb8af14420125bb6cd165fa8827942583
parenta8e73f80974038516054a042ed1b811c781c9db8 (diff)
downloadtemplater-1148ec488e42984a32a3221662171ebc35c3edf9.tar.gz
templater-1148ec488e42984a32a3221662171ebc35c3edf9.tar.bz2
Post receive hook accepting Makefile deploy target
-rwxr-xr-xshare/templater/drupal8/files/bin/post-receive10
-rwxr-xr-xshare/templater/drupal8/setup4
-rwxr-xr-xshare/templater/pushtodeploy/files/post-receive26
3 files changed, 30 insertions, 10 deletions
diff --git a/share/templater/drupal8/files/bin/post-receive b/share/templater/drupal8/files/bin/post-receive
new file mode 100755
index 0000000..c9c0e79
--- /dev/null
+++ b/share/templater/drupal8/files/bin/post-receive
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# Post-receive git hook.
+#
+
+echo "Deploying on `cat /etc/hostname`..."
+
+cd ..
+unset GIT_DIR
+make deploy
diff --git a/share/templater/drupal8/setup b/share/templater/drupal8/setup
index b66d6bf..1fbaa07 100755
--- a/share/templater/drupal8/setup
+++ b/share/templater/drupal8/setup
@@ -54,6 +54,10 @@ function templater_drupal8 {
cp $SHARE/drupal8/files/Puppetfile puppet/Puppetfile.drupal8
fi
+ if [ ! -e "bin/post-receive" ]; then
+ mkdir -p bin && cp $SHARE/drupal8/files/bin/post-receive bin/
+ fi
+
mkdir -p files config/sync themes modules libraries vendor
touch {files,config,themes,modules,libraries,vendor}/.empty
git add -f {files,config/sync,themes,modules,libraries}/.empty
diff --git a/share/templater/pushtodeploy/files/post-receive b/share/templater/pushtodeploy/files/post-receive
index 627198d..3e706e9 100755
--- a/share/templater/pushtodeploy/files/post-receive
+++ b/share/templater/pushtodeploy/files/post-receive
@@ -3,19 +3,25 @@
# Post-receive git hook
#
+# Go to repository base
cd ..
unset GIT_DIR
-if [ -d ".git/annex" ]; then
- git annex sync
+# Check for a Makefile deploy target or run standard deployment
+if [ -e "Makefile" ] && grep -q "^deploy:" Makefile; then
+ make deploy
else
- git config receive.denyCurrentBranch ignore
- #git reset HEAD
- git checkout -f
-fi
+ if [ -d ".git/annex" ]; then
+ git annex sync
+ else
+ git config receive.denyCurrentBranch ignore
+ #git reset HEAD
+ git checkout -f
+ fi
-git submodule sync --recursive
-git submodule update --init --recursive
+ git submodule sync --recursive
+ git submodule update --init --recursive
-cd -
-exec git update-server-info
+ cd -
+ exec git update-server-info
+fi