-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathuploadArtifacts.js
More file actions
31 lines (27 loc) · 871 Bytes
/
uploadArtifacts.js
File metadata and controls
31 lines (27 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
const fs = require('fs');
module.exports = {
uploadArtifacts() {
if (this.provider.progress) {
this.provider.progress.get('deploy').update('Uploading artifacts');
} else {
this.serverless.cli.log('Uploading artifacts...');
}
const params = {
bucket: this.serverless.service.provider.deploymentBucketName,
resource: {
name: this.serverless.service.package.artifactFilePath,
contentType: 'application/octet-stream',
},
media: {
mimeType: 'application/octet-stream',
body: fs.createReadStream(this.serverless.service.package.artifact),
},
};
return this.provider.request('storage', 'objects', 'insert', params).then(() => {
if (!this.provider.progress) {
this.serverless.cli.log('Artifacts successfully uploaded...');
}
});
},
};