#!/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 )" >&2 exit 1 fi if [[ -z "$refname" ]] || [[ -z "$oldrev" ]] || [[ -z "$newrev" ]] then echo "usage: $0 " >&2 exit 1 fi # --- Upon branch update, build gitweb snapshot URI git_project_name=$(pwd | grep -o '[a-zA-Z0-9-]*\.git') echo "Git project name - $git_project_name" snapshot_uri=https://git.purplebirdman.com/${git_project_name}/snapshot/${newrev}.tar.gz echo "Snapshot URI - $snapshot_uri" # --- 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