Skip to content

Commit a69ef3e

Browse files
committedDec 7, 2015
Added binary uploads.
1 parent 4209d55 commit a69ef3e

File tree

2 files changed

+47
-7
lines changed

2 files changed

+47
-7
lines changed
 

‎rakelib/deploy.rake

+46-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,61 @@
11
require 'aws-sdk'
2+
require 'pathname'
23

34
desc "Deploy a Rubinius release"
45
task :deploy do
5-
s3 = Aws::S3::Resource.new(region: "us-west-2")
6+
s3 = Aws::S3::Client.new(region: "us-west-2")
7+
file_exts = ["", ".md5", ".sha1", ".sha512"]
8+
9+
# TODO: extract the name to a method
10+
basename = "rubinius-#{rbx_version}.tar.bz2"
611

712
# Build and upload the release tarball to S3.
813
if ENV["TRAVIS_OS_NAME"] == "linux" and ENV["CC"] == "clang" and ENV["RVM"] == "rbx-2"
9-
# TODO: extract the name to a method
10-
basename = "rubinius-#{rbx_version}.tar.bz2"
11-
1214
puts "Deploying release tarball #{basename}..."
1315

1416
Rake::Task['release'].invoke
1517

16-
["", ".md5", ".sha1", ".sha512"].each do |ext|
18+
bucket = "rubinius-releases-rubinius-com"
19+
20+
index = "index.txt"
21+
index_list = s3.get_object(bucket: bucket, key: index).body.read
22+
23+
file_exts.each do |ext|
24+
name = basename + ext
25+
s3.put_object bucket: bucket, key: name, body: File.read(name)
26+
27+
index_list << name << "\n" unless index_list =~ /#{name}/
28+
end
29+
30+
s3.put_object bucket: bucket, key: index, body: index_list
31+
end
32+
33+
# Build and upload a binary to S3.
34+
if ENV["RVM"] == "rbx-2"
35+
puts "Deploying Travis binary #{basename}..."
36+
37+
Rake::Task['package:binary'].invoke
38+
39+
url_prefix = "https://rubinius-binaries-rubinius-com.s3-us-west-2.amazonaws.com/"
40+
bucket = "rubinius-binaries-rubinius-com"
41+
42+
if ENV["TRAVIS_OS_NAME"] == "linux"
43+
path_prefix = "ubuntu/12.04/x86_64/"
44+
else
45+
path_prefix = "osx/10.9/x86_64/"
46+
end
47+
48+
index_list = s3.get_object(bucket: bucket, key: index).body.read
49+
50+
file_exts.each do |ext|
1751
name = basename + ext
18-
obj = s3.bucket("rubinius-releases-rubinius-com").object(name)
19-
obj.upload_file(name)
52+
key = prefix + name
53+
s3.put_object bucket: bucket, key: key, body: File.read(name)
54+
55+
path = url_prefix + key
56+
index_list << path << "\n" unless index_list =~ /#{path}/
2057
end
58+
59+
s3.put_object bucket: bucket, key: index, body: index_list
2160
end
2261
end

‎rakelib/package.rb

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def build
131131
create_archive package_name
132132
write_md5_digest_file package_name
133133
write_sha1_digest_file package_name
134+
write_sha512_digest_file package_name
134135
rescue Object => e
135136
# Some rake versions swallow the backtrace, so we do it explicitly.
136137
STDERR.puts e.message, e.backtrace

0 commit comments

Comments
 (0)
Please sign in to comment.