Skip to content

Commit 5080c00

Browse files
committed
Add S3 upload task
1 parent c8347f4 commit 5080c00

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tasks/package.rake

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,32 @@ require 'fileutils'
33

44
module PackageHelpers
55
def curl(file)
6-
system "curl -L -O --fail --silent #{file} > /dev/null"
6+
system "curl -L -O --fail --silent #{file}"
77
end
88

99
def print_to_console(msg)
1010
puts "[#{arch}]:" + ' ' * (16 - arch.size) + '=>' + ' ' + msg
1111
end
12+
13+
def extract_cloudfront_url
14+
`s3cmd cfinfo s3://octodown`.match '[a-zA-Z0-9]*.cloudfront.net ' \
15+
'2> /dev/null'
16+
end
17+
18+
def upload_to_s3
19+
print_to_console 'Uploading to S3...'
20+
filename = "#{dir}.tar.gz"
21+
22+
FileUtils.cd 'distro' do
23+
system "s3cmd put -f #{filename} s3://octodown/releases/#{filename} " \
24+
'&> /dev/null'
25+
system 's3cmd setacl s3://octodown --acl-public --recursive ' \
26+
'&> /dev/null'
27+
28+
url = "http://#{extract_cloudfront_url}/releases/#{filename}"
29+
puts '', "Uploaded to: #{url}"
30+
end
31+
end
1232
end
1333

1434
class Package

0 commit comments

Comments
 (0)