-
Notifications
You must be signed in to change notification settings - Fork 0
/
github.rake
33 lines (25 loc) · 903 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
# frozen_string_literal: true
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-rails'
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 + "\n" + `rake changelog:latest`,
prerelease: $VERSION.match('rc') ? true : false
)
gh.upload_asset(release.url, "aws-sdk-rails-#{$VERSION}.gem",
content_type: 'application/octet-stream')
end
task 'github:access_token'