#!/bin/sh # # A git hook script for the "post-receive" event. # # The "post-receive" script is run after receive-pack has accepted a pack # see contrib/hooks/ for a sample, or uncomment the next line and # rename the file to "post-receive". # Change your post url and token if needed # Get the lastest commit log msg=$(git log -1 --pretty=format:"%s") # Check whether to active the notice is_active=$(echo "$msg" | grep "\[deploy\]") if [ -z "$is_active" ]; then echo >&2 "[info] Not to auto deploy" exit 1 fi # Curl url=WEB_URL token=YOUR_TOKEN echo "================Auto Deploy==================" curl -H "Content-Type: application/json" -X POST -s -d "{\"token\":\"$token\"}" $url echo "================Auto Deploy=================="