forked from laurilehmijoki/s3_website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release
executable file
·41 lines (33 loc) · 1.22 KB
/
release
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
37
38
39
40
41
#!/usr/bin/env ruby
require 'octokit'
require_relative 'lib/s3_website/version'
version = S3Website::VERSION
unless ENV['S3_WEBSITE_RELEASE_KEY']
puts "Set the S3_WEBSITE_RELEASE_KEY environmental variable. It should be your personal GitHub access token."
puts "Go to https://github.com/settings/applications#personal-access-tokens."
exit 1
end
def run(cmd)
unless system(cmd)
exit 1
end
end
puts "Building s3_website.jar..."
jar_location = 'target/scala-2.11/s3_website.jar'
run "./sbt clean assembly"
# The bin s3_website uses the MD5 checksum to verify that the jar is not corrupted
jar_md5 = Digest::MD5.file(jar_location).hexdigest
File.write('resources/s3_website.jar.md5', jar_md5)
tag_name = "v#{version}"
run "git tag #{tag_name} && git push origin #{tag_name}"
run "git push"
run "rake build"
client = Octokit::Client.new(:login => 'laurilehmijoki', :password => ENV['S3_WEBSITE_RELEASE_KEY'])
release = client.create_release(
'laurilehmijoki/s3_website',
tag_name,
:body => "See https://github.com/laurilehmijoki/s3_website/blob/master/changelog.md##{version.gsub('.', '')}"
)
puts "Uploading s3_website.jar..."
client.upload_asset(release[:url], jar_location)
run "gem push pkg/s3_website-#{version}.gem"