Skip to content

Commit 28d6e21

Browse files
committed
[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.
1 parent 99756dd commit 28d6e21

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

RELEASE.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ services)
2323
* Update the version number (`lib/fog/version.rb`)
2424
* Run `rake changelog` to update `changelog.txt`
2525
* Run `rake release` to prepare the release which does:
26-
* Builds the gem (`rake build`)
27-
* Tags the commit
28-
* Creates commits for version and pushes to github (Requires
29-
Credentials)
30-
* Pushes gem to rubygems (Requires Credentials)
31-
* Creates site documentation (`rake docs`)
32-
* Pushes site documentation to S3 (Requires Credentials)
26+
* Prepares the release (`rake release:prepare`)
27+
* Builds the gem
28+
* Tags the commit
29+
* Creates commits for version
30+
* Publishes the release (`rake release:publish`)
31+
* Pushes commit and tag to Github (Requires Credentials)
32+
* Pushes gem to Rubygems (Requires Credentials)
3333

3434
## Announce the release
3535

Rakefile

+32-5
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,43 @@ end
9595
#
9696
#############################################################################
9797

98-
task :release => :build do
99-
unless `git branch` =~ /^\* master$/
100-
puts "You must be on the master branch to release!"
101-
exit!
98+
task :release => ["release:prepare", "release:publish"]
99+
100+
namespace :release do
101+
task :preflight do
102+
unless `git branch` =~ /^\* master$/
103+
puts "You must be on the master branch to release!"
104+
exit!
105+
end
106+
if `git tag` =~ /^\* v#{version}$/
107+
puts "Tag v#{version} already exists!"
108+
exit!
109+
end
110+
end
111+
112+
task :prepare => :preflight do
113+
Rake::Task[:build].invoke
114+
sh "gem install pkg/#{name}-#{version}.gem"
115+
Rake::Task[:git_mark_release].invoke
116+
end
117+
118+
task :publish do
119+
Rake::Task[:git_push_release].invoke
120+
Rake::Task[:gem_push].invoke
102121
end
103-
sh "gem install pkg/#{name}-#{version}.gem"
122+
end
123+
124+
task :git_mark_release do
104125
sh "git commit --allow-empty -a -m 'Release #{version}'"
105126
sh "git tag v#{version}"
127+
end
128+
129+
task :git_push_release do
106130
sh "git push origin master"
107131
sh "git push origin v#{version}"
132+
end
133+
134+
task :gem_push do
108135
sh "gem push pkg/#{name}-#{version}.gem"
109136
end
110137

0 commit comments

Comments
 (0)