forked from aws/aws-sdk-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub.rake
36 lines (27 loc) · 1013 Bytes
/
github.rake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
task 'github:require-access-token' do
unless ENV['AWS_SDK_FOR_RUBY_GH_TOKEN']
warn("export ENV['AWS_SDK_FOR_RUBY_GH_TOKEN']")
exit
end
end
# this task must be defined to deploy
task 'github:access-token'
task 'github:release' do
require 'octokit'
gh = Octokit::Client.new(access_token: ENV['AWS_SDK_FOR_RUBY_GH_TOKEN'])
repo = 'aws/aws-sdk-ruby'
tag_ref_sha = `git show-ref v#{$VERSION}`.split(' ').first
tag = gh.tag(repo, tag_ref_sha)
release = gh.create_release(repo, "v#{$VERSION}", {
name: 'Release v' + $VERSION + ' - ' + tag.tagger.date.strftime('%Y-%m-%d'),
body: tag.message.lines.to_a[2..-1].join + `rake changelog:latest`,
prerelease: $VERSION.match('rc') ? true : false,
})
gh.upload_asset(release.url, 'api-docs.zip',
:content_type => 'application/octet-stream')
$GEM_NAMES.each do |gem_name|
gh.upload_asset(release.url, "#{gem_name}-#{$VERSION}.gem",
:content_type => 'application/octet-stream')
end
end
task 'github:access_token'