[core] Breaks down rake tasks

While documenting our release process, we can see some things that don't
need to be locked together are.

This splits release into prepare/publish parts

Now anyone can prepare a release but will not be able to publish that
release without the correct access to Github and Rubygems.

Adds a preflight task and adds a check for existing tags to that.
This commit is contained in:
Paul Thornthwaite 2012-12-27 21:41:28 +00:00
parent 99756dd679
commit 28d6e219f3
2 changed files with 39 additions and 12 deletions

View File

@ -23,13 +23,13 @@ services)
* Update the version number (`lib/fog/version.rb`)
* Run `rake changelog` to update `changelog.txt`
* Run `rake release` to prepare the release which does:
* Builds the gem (`rake build`)
* Tags the commit
* Creates commits for version and pushes to github (Requires
Credentials)
* Pushes gem to rubygems (Requires Credentials)
* Creates site documentation (`rake docs`)
* Pushes site documentation to S3 (Requires Credentials)
* Prepares the release (`rake release:prepare`)
* Builds the gem
* Tags the commit
* Creates commits for version
* Publishes the release (`rake release:publish`)
* Pushes commit and tag to Github (Requires Credentials)
* Pushes gem to Rubygems (Requires Credentials)
## Announce the release

View File

@ -95,16 +95,43 @@ end
#
#############################################################################
task :release => :build do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
task :release => ["release:prepare", "release:publish"]
namespace :release do
task :preflight do
unless `git branch` =~ /^\* master$/
puts "You must be on the master branch to release!"
exit!
end
if `git tag` =~ /^\* v#{version}$/
puts "Tag v#{version} already exists!"
exit!
end
end
sh "gem install pkg/#{name}-#{version}.gem"
task :prepare => :preflight do
Rake::Task[:build].invoke
sh "gem install pkg/#{name}-#{version}.gem"
Rake::Task[:git_mark_release].invoke
end
task :publish do
Rake::Task[:git_push_release].invoke
Rake::Task[:gem_push].invoke
end
end
task :git_mark_release do
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git tag v#{version}"
end
task :git_push_release do
sh "git push origin master"
sh "git push origin v#{version}"
end
task :gem_push do
sh "gem push pkg/#{name}-#{version}.gem"
end