Skip to content

Instantly share code, notes, and snippets.

@elinaldosoft
Created March 27, 2019 14:46
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 elinaldosoft/9ab17844242239897b8b63ef6d1ccadd to your computer and use it in GitHub Desktop.
Save elinaldosoft/9ab17844242239897b8b63ef6d1ccadd to your computer and use it in GitHub Desktop.
Release deploy, sentry by capistrano 3
require 'net/https'
require 'uri'
require 'json'
namespace :sentry do
task :notify_deployment do
run_locally do
puts 'Notifying Sentry of release...'
uri = URI.parse(SENTY_URL)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request.body = {:version => fetch(:release_timestamp)}.to_json
request.add_field('Content-Type', 'application/json')
response = http.request(request)
puts "Sentry response: #{response.body}"
end
end
end
after 'deploy:published', 'sentry:notify_deployment'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment