我想将make auto部署如下:
你可以帮忙吗?
答案 0 :(得分:1)
<强>解决强>
在githook post-receive
中编写脚本,如:
process_ref() {
oldrev=$(git rev-parse $1)
newrev=$(git rev-parse $2)
refname="$3"
arr=(${refname//// })
name="${arr[2]}"
case "$refname" in
refs/tags/*)
if expr "$oldrev" : '00*$' >/dev/null
then
echo "tag name $name"
sh trigger-script-on-creating-tag.sh
fi
;;
refs/heads/*)
echo "branch name $name"
sh trigger-on-creating-branch-or-pushed-code.sh
;;
*)
echo "other"
exit 1
esac
}
while read REF; do process_ref $REF; done