Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tools] Add confirmation to 'rake pypi:release' task #791

Merged
merged 5 commits into from
Jan 25, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 26 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,31 @@ end
namespace :pypi do
RELEASE_DIR = '/tmp/dd-trace-py-release'

def get_version()
return `python setup.py --version`.strip
end

def get_branch()
return `git name-rev --name-only HEAD`.strip
end

task :confirm do
ddtrace_version = get_version

if get_branch.downcase != 'tags/v#{ddtrace_version}'
print "WARNING: Expected current commit to be tagged as 'tags/v#{ddtrace_version}, instead we are on '#{get_branch}', proceed anyways [y|N]? "
$stdout.flush

abort if $stdin.gets.to_s.strip.downcase != 'y'
end

puts "WARNING: This task will build and release a new wheel to https://pypi.org/project/ddtrace/, this action cannot be undone"
print " To proceed please type the version '#{ddtrace_version}': "
$stdout.flush

abort if $stdin.gets.to_s.strip.downcase != ddtrace_version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! 👍 👍

end

task :clean do
FileUtils.rm_rf(RELEASE_DIR)
end
Expand All @@ -130,7 +155,7 @@ namespace :pypi do
sh "python setup.py -q sdist -d #{RELEASE_DIR}"
end

task :release => [:install, :build] do
task :release => [:confirm, :install, :build] do
builds = Dir.entries(RELEASE_DIR).reject {|f| f == '.' || f == '..'}
if builds.length == 0
fail "no build found in #{RELEASE_DIR}"
Expand Down