mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-23 07:36:12 +08:00
Merge pull request #998 from nylas/set_s3_content_type
set the ContentType when uploading packages to S3.
This commit is contained in:
commit
ad9242a387
1 changed files with 13 additions and 8 deletions
|
@ -62,21 +62,24 @@ module.exports = (grunt) ->
|
|||
return reject(err) if err
|
||||
resolve()
|
||||
|
||||
put = (localSource, destName) ->
|
||||
put = (localSource, destName, options = {}) ->
|
||||
grunt.log.writeln ">> Uploading #{localSource} to S3…"
|
||||
|
||||
write = grunt.log.writeln
|
||||
ext = path.extname(destName)
|
||||
lastPc = 0
|
||||
|
||||
params =
|
||||
Key: destName
|
||||
ACL: "public-read"
|
||||
Bucket: "edgehill"
|
||||
|
||||
_.extend(params, options)
|
||||
|
||||
new Promise (resolve, reject) ->
|
||||
uploader = s3Client.uploadFile
|
||||
localFile: localSource
|
||||
s3Params:
|
||||
Key: destName
|
||||
ACL: "public-read"
|
||||
Bucket: "edgehill"
|
||||
|
||||
s3Params: params
|
||||
uploader.on "error", (err) ->
|
||||
reject(err)
|
||||
uploader.on "progress", ->
|
||||
|
@ -158,9 +161,11 @@ module.exports = (grunt) ->
|
|||
files = fs.readdirSync(buildDir)
|
||||
for file in files
|
||||
if path.extname(file) is '.deb'
|
||||
uploadPromises.push uploadToS3(file, "#{fullVersion}/#{process.platform}-deb/#{process.arch}/N1.deb")
|
||||
uploadPromises.push uploadToS3(file, "#{fullVersion}/#{process.platform}-deb/#{process.arch}/N1.deb",
|
||||
{"ContentType": "application/x-deb"})
|
||||
if path.extname(file) is '.rpm'
|
||||
uploadPromises.push uploadToS3(file, "#{fullVersion}/#{process.platform}-rpm/#{process.arch}/N1.rpm")
|
||||
uploadPromises.push uploadToS3(file, "#{fullVersion}/#{process.platform}-rpm/#{process.arch}/N1.rpm",
|
||||
{"ContentType": "application/x-rpm"})
|
||||
|
||||
else
|
||||
grunt.fail.fatal "Unsupported platform: '#{process.platform}'"
|
||||
|
|
Loading…
Reference in a new issue