Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- echo "Content-type:text/plain\n"
- if
- [ -n "$HTTP_X_HOOK_UUID" ] &&
- [ -n "$HTTP_X_REQUEST_UUID" ] &&
- [ "$HTTP_X_EVENT_KEY" = "repo:push" ] &&
- [ "$HTTP_CONTENT_TYPE" = "application/json" ] &&
- [ "$REQUEST_METHOD" = "POST" ]
- then
- MASTER_COMMITS=`jq '[.push.changes[].new | select(.name == "master" and .type == "branch")] | length'`
- if [ "$MASTER_COMMITS" -gt 0 ]
- then
- cd ./repo
- GIT_SSH_COMMAND='ssh -i /var/www/deploy/access-key -o UserKnownHostsFile=/dev/null'
- git fetch --all 2>&1
- git reset --hard origin/master
- ./build.sh
- echo "Build complete"
- else
- echo "Build skipped"
- fi
- else
- echo "Wrong request"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement