generated from actions/javascript-action
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathuploader.js
More file actions
21 lines (17 loc) · 541 Bytes
/
uploader.js
File metadata and controls
21 lines (17 loc) · 541 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const core = require('@actions/core');
const cloudinary = require('cloudinary').v2;
const path = require('path');
module.exports = function uploader(cloudName, apiKey, apiSecret, files) {
cloudinary.config({
cloud_name: cloudName,
api_key: apiKey,
api_secret: apiSecret
});
const cloudinaryUploader = file => {
core.info(`uploading ${file}`);
return cloudinary.uploader.upload(file, {
public_id: path.basename(file, path.extname(file)),
});
};
return Promise.all(files.map(cloudinaryUploader));
}