]> Untitled Git - git-webhooks.git/commitdiff
Initial version
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Wed, 19 Mar 2025 12:04:46 +0000 (07:04 -0500)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Wed, 19 Mar 2025 12:36:53 +0000 (07:36 -0500)
update-godot-builder.sh [new file with mode: 0755]

diff --git a/update-godot-builder.sh b/update-godot-builder.sh
new file mode 100755 (executable)
index 0000000..d85754c
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
+# To enable this hook, rename this file to "update".
+
+# --- Command line
+refname="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+if [[ -z "$GIT_DIR" ]]
+then
+       echo "Don't run this script from the command line." >&2
+       echo " (if you want, you could supply GIT_DIR then run" >&2
+       echo "  $0 <ref> <oldrev> <newrev>)" >&2
+       exit 1
+fi
+
+if [[ -z "$refname" ]] || [[ -z "$oldrev" ]] || [[ -z "$newrev" ]]
+then
+       echo "usage: $0 <ref> <oldrev> <newrev>" >&2
+       exit 1
+fi
+
+# --- Upon branch update, build gitweb snapshot URI
+# TODO: get project name based on current directory name
+project_name=wolf-seeking-sheep
+snapshot_uri=https://git.purplebirdman.com/${project_name}.git/snapshot/${newrev}.tar.gz
+echo "Snapshot URI - https://git.purplebirdman.com/${project_name}.git/snapshot/${newrev}.tar.gz"
+
+# --- Now send request to builder service
+godot_builder_uri=https://godot.purplebirdman.com/hook/make-build-request.lua
+
+echo "Sending build request..."
+curl -Ss --get --data-urlencode "snapshot_uri=${snapshot_uri}" $godot_builder_uri
+
+exit 0