Skip to content

Commit

Permalink
Added binary uploads.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Dec 7, 2015
1 parent 4209d55 commit a69ef3e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 7 deletions.
53 changes: 46 additions & 7 deletions rakelib/deploy.rake
@@ -1,22 +1,61 @@
require 'aws-sdk'
require 'pathname'

desc "Deploy a Rubinius release"
task :deploy do
s3 = Aws::S3::Resource.new(region: "us-west-2")
s3 = Aws::S3::Client.new(region: "us-west-2")
file_exts = ["", ".md5", ".sha1", ".sha512"]

# TODO: extract the name to a method
basename = "rubinius-#{rbx_version}.tar.bz2"

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

puts "Deploying release tarball #{basename}..."

Rake::Task['release'].invoke

["", ".md5", ".sha1", ".sha512"].each do |ext|
bucket = "rubinius-releases-rubinius-com"

index = "index.txt"
index_list = s3.get_object(bucket: bucket, key: index).body.read

file_exts.each do |ext|
name = basename + ext
s3.put_object bucket: bucket, key: name, body: File.read(name)

index_list << name << "\n" unless index_list =~ /#{name}/
end

s3.put_object bucket: bucket, key: index, body: index_list
end

# Build and upload a binary to S3.
if ENV["RVM"] == "rbx-2"
puts "Deploying Travis binary #{basename}..."

Rake::Task['package:binary'].invoke

url_prefix = "https://rubinius-binaries-rubinius-com.s3-us-west-2.amazonaws.com/"
bucket = "rubinius-binaries-rubinius-com"

if ENV["TRAVIS_OS_NAME"] == "linux"
path_prefix = "ubuntu/12.04/x86_64/"
else
path_prefix = "osx/10.9/x86_64/"
end

index_list = s3.get_object(bucket: bucket, key: index).body.read

file_exts.each do |ext|
name = basename + ext
obj = s3.bucket("rubinius-releases-rubinius-com").object(name)
obj.upload_file(name)
key = prefix + name
s3.put_object bucket: bucket, key: key, body: File.read(name)

path = url_prefix + key
index_list << path << "\n" unless index_list =~ /#{path}/
end

s3.put_object bucket: bucket, key: index, body: index_list
end
end
1 change: 1 addition & 0 deletions rakelib/package.rb
Expand Up @@ -131,6 +131,7 @@ def build
create_archive package_name
write_md5_digest_file package_name
write_sha1_digest_file package_name
write_sha512_digest_file package_name
rescue Object => e
# Some rake versions swallow the backtrace, so we do it explicitly.
STDERR.puts e.message, e.backtrace
Expand Down

0 comments on commit a69ef3e

Please sign in to comment.