-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-commit
27 lines (26 loc) · 930 Bytes
/
post-commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
#
# post-commit code to call build server to get changes and build
# dev ops project milestone build
# ian drosos
echo "Committed... Pushing to repo and notifying build server to build branch"
unamestr=`uname -o`
# http://stackoverflow.com/questions/6245570/how-to-get-the-current-branch-name-in-git
branch=`git rev-parse --abbrev-ref HEAD`
dev='dev'
rel='release'
# http://stackoverflow.com/questions/2765421/how-to-push-a-new-local-branch-to-a-remote-git-repository-and-track-it-too
git push -u origin $branch
# now that code is pushed to the branch committed to, notify server
echo "$branch"
if [[ "$branch" = "$dev" ]];
then
echo "Notifying server to build dev branch"
curl http://54.191.99.255:3000/dev
elif [[ "$branch" = "$rel" ]];
then
echo "Notifying server to build release branch"
curl http://54.191.99.255:3000/release
else
echo "NOT A SUPPORTED BRANCH, BUILDSERVER WILL NOT BUILD YOUR BRANCH"
fi