list

scripts

Repo containing scripts to be used with dovel, and git hooks that powers our web interface.

curl https://dovel.email/scripts.tar tar

c1e6214

Author: brian (git@myr.sh)

Date: Tue Sep 19 01:10:37 2023 -0300

Parent: 6fd0665

Added git hooks

Diff

diff --git a/post-receive b/post-receive
index 52a8911..664ce5a 100755
--- a/post-receive
+++ b/post-receive
@@ -3,10 +3,8 @@
#for debugging
#set -ex

-# the work tree, where the checkout/deploy should happen
-TGT="$(mktemp)"
OUT="~/www/dovel.email/"
-GITDIR="~/dovel.email/"
+GITDIR="~/git/dovel.email/"

# git.html lists all repos
cat << EOF
@@ -65,16 +63,13 @@ cat << EOF
</html>
EOF

-# the location of the .git directory
-GIT_DIR="/home/blmayer/git/site"
-
# create commit pages
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [ "$ref" = "refs/heads/$BRANCH" ]
then
-                git --work-tree="/home/blmayer/www/myr.sh" --git-dir="${GIT_DIR}" checkout -f ${BRANCH}
+                #git --work-tree="/home/blmayer/www/myr.sh" --git-dir="${GIT_DIR}" checkout -f ${BRANCH}
else
echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
fi
diff --git a/post-receive-scripts b/post-receive-scripts
new file mode 100755
index 0000000..192d674
--- /dev/null
+++ b/post-receive-scripts
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#for debugging
+#set -ex
+
+
+# the location of the .git directory
+# GIT_DIR="/home/blmayer/git/dovel/scripts"
+
+BRANCH="main"
+
+while read oldrev newrev ref
+do
+        # only checking out the master (or whatever branch you would like to deploy)
+        if [ "$ref" = "refs/heads/$BRANCH" ]
+        then
+                echo "Ref $ref received. Deploying ${BRANCH} branch on server..."
+		TMP="$(mktemp)"
+                git --work-tree="$tmp" checkout -f ${BRANCH}
+		cp "$TMP/post-receive-scripts" "./hooks/post-receive"
+        else
+                echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
+        fi
+done