]> gitweb.fluxo.info Git - templater.git/commitdiff
Post receive hook accepting Makefile deploy target
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 14 Nov 2017 12:45:27 +0000 (10:45 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 14 Nov 2017 12:45:27 +0000 (10:45 -0200)
share/templater/drupal8/files/bin/post-receive [new file with mode: 0755]
share/templater/drupal8/setup
share/templater/pushtodeploy/files/post-receive

diff --git a/share/templater/drupal8/files/bin/post-receive b/share/templater/drupal8/files/bin/post-receive
new file mode 100755 (executable)
index 0000000..c9c0e79
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# Post-receive git hook.
+#
+
+echo "Deploying on `cat /etc/hostname`..."
+
+cd ..
+unset GIT_DIR
+make deploy
index b66d6bf0ce6be0d59efabe1e12732fd24f9923aa..1fbaa0745172ffaf49c9b90960f838e90f2c8eea 100755 (executable)
@@ -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
index 627198de009239bb6c99180aed1bf480e1cd190a..3e706e98432988084ded70c0895834ed4b957e1b 100755 (executable)
@@ -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