Created
March 27, 2019 14:46
-
-
Save elinaldosoft/9ab17844242239897b8b63ef6d1ccadd to your computer and use it in GitHub Desktop.
Release deploy, sentry by capistrano 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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