#!/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 # 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