This repository has been archived on 2020-01-17. You can view files and clone it, but cannot push or open issues or pull requests.
vn-repo/git-hooks/post-receive

18 lines
367 B
Bash
Executable File

#!/bin/bash
set -e
while read oldrev newrev ref
do
if [[ ! $ref =~ .*/master$ ]]; then
continue
fi
repoDir=$(dirname "$0")/..
projectName=$(basename "$(realpath "$repoDir")")
echo "Ref $ref received. It will be deployed automatically."
#echo "$projectName" "master" > /tmp/vn-repo.changes
nohup sudo -u vn-repo vn-branch $projectName &> /dev/null &
done