Skip to content

Instantly share code, notes, and snippets.

@Jamedjo
Created August 21, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jamedjo/640e537061410351c7a7 to your computer and use it in GitHub Desktop.
Save Jamedjo/640e537061410351c7a7 to your computer and use it in GitHub Desktop.
NewRelic git deployment hook
#!/bin/bash
production="refs/heads/production"
apikey="0001230120301203012030120301230"
application_id="1234567"
user=$(git config user.name)
while read local_ref local_sha remote_ref remote_sha
do
if [ "$remote_ref" == $production ]; then
curl -H "x-api-key:$apikey" -d "deployment[application_id]=$application_id" -d "deployment[revision]=$local_sha" -d "deployment[user]=$user" https://api.newrelic.com/deployments.xml
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment