-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
22 lines (16 loc) · 835 Bytes
/
Rakefile
File metadata and controls
22 lines (16 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'bundler'
Bundler.require
task :default => [:publish]
AWS_ACCESS_KEY_ID = ENV['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = ENV['AWS_SECRET_ACCESS_KEY']
S3_BUCKET = ENV['S3_BUCKET']
desc "publish the latest rpm of a project to S3"
task :publish, :package do |t, args|
connection = Fog::Storage.new( provider: :AWS,
aws_access_key_id: AWS_ACCESS_KEY_ID,
aws_secret_access_key: AWS_SECRET_ACCESS_KEY)
directory = connection.directories.new( key: S3_BUCKET )
package = Dir.open("./pkg").entries.select {|e| e[/^#{args.package}(.*)\.rpm$/]}.sort.last
package_path = "./pkg/#{package}"
p directory.files.create(key: "#{args.package.split('-').first}/#{package}", body: File.open(package_path), public: false)
end