Skip to content

Commit 33763b8

Browse files
chore: build dist upload-cloud-storage (#27)
1 parent a2ee322 commit 33763b8

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

dist/index.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5831,9 +5831,15 @@ function run() {
58315831
const path = core.getInput('path', { required: true });
58325832
const destination = core.getInput('destination', { required: true });
58335833
const gzip = core.getInput('gzip', { required: false }) === 'false' ? false : true;
5834+
const predefinedAclInput = core.getInput('predefinedAcl', {
5835+
required: false,
5836+
});
5837+
const predefinedAcl = predefinedAclInput === ''
5838+
? undefined
5839+
: predefinedAclInput;
58345840
const serviceAccountKey = core.getInput('credentials');
58355841
const client = new client_1.Client({ credentials: serviceAccountKey });
5836-
const uploadResponses = yield client.upload(destination, path, gzip);
5842+
const uploadResponses = yield client.upload(destination, path, gzip, predefinedAcl);
58375843
core.setOutput('uploaded', uploadResponses
58385844
.map((uploadResponse) => uploadResponse[0].name)
58395845
.toString());
@@ -17514,9 +17520,9 @@ class UploadHelper {
1751417520
* @param destination The destination prefix.
1751517521
* @returns The UploadResponse which contains the file and metadata.
1751617522
*/
17517-
uploadFile(bucketName, filename, gzip, destination) {
17523+
uploadFile(bucketName, filename, gzip, destination, predefinedAcl) {
1751817524
return __awaiter(this, void 0, void 0, function* () {
17519-
const options = { gzip };
17525+
const options = { gzip, predefinedAcl };
1752017526
if (destination) {
1752117527
// If obj prefix is set, then extract filename and append to prefix.
1752217528
options.destination = `${destination}/${path.posix.basename(filename)}`;
@@ -17537,7 +17543,7 @@ class UploadHelper {
1753717543
* @param clearExistingFilesFirst Clean files in the prefix before uploading.
1753817544
* @returns The list of UploadResponses which contains the file and metadata.
1753917545
*/
17540-
uploadDirectory(bucketName, directoryPath, gzip, prefix = '') {
17546+
uploadDirectory(bucketName, directoryPath, gzip, prefix = '', predefinedAcl) {
1754117547
return __awaiter(this, void 0, void 0, function* () {
1754217548
const pathDirName = path.posix.dirname(directoryPath);
1754317549
// Get list of files in the directory.
@@ -17549,7 +17555,7 @@ class UploadHelper {
1754917555
if (prefix) {
1755017556
destination = `${prefix}/${destination}`;
1755117557
}
17552-
const uploadResp = yield this.uploadFile(bucketName, filePath, gzip, destination);
17558+
const uploadResp = yield this.uploadFile(bucketName, filePath, gzip, destination, predefinedAcl);
1755317559
return uploadResp;
1755417560
})));
1755517561
return resp;
@@ -27207,7 +27213,7 @@ pki.privateKeyInfoToPem = function(pki, maxline) {
2720727213
* @returns {Array.<string>} a compiled object
2720827214
*/
2720927215
date.compile = function (formatString) {
27210-
var re = /\[([^\[\]]*|\[[^\[\]]*\])*\]|([A-Za-z])\2+|\.{3}|./g, keys, pattern = [formatString];
27216+
var re = /\[([^\[\]]|\[[^\[\]]*])*]|([A-Za-z])\2+|\.{3}|./g, keys, pattern = [formatString];
2721127217

2721227218
while ((keys = re.exec(formatString))) {
2721327219
pattern[pattern.length] = keys[0];
@@ -64791,7 +64797,7 @@ class Client {
6479164797
* @param prefix Optional prefix when uploading to GCS.
6479264798
* @returns List of uploaded file(s).
6479364799
*/
64794-
upload(destination, path, gzip) {
64800+
upload(destination, path, gzip, predefinedAcl) {
6479564801
return __awaiter(this, void 0, void 0, function* () {
6479664802
let bucketName = destination;
6479764803
let prefix = '';
@@ -64804,11 +64810,11 @@ class Client {
6480464810
const stat = yield fs.promises.stat(path);
6480564811
const uploader = new upload_helper_1.UploadHelper(this.storage);
6480664812
if (stat.isFile()) {
64807-
const uploadedFile = yield uploader.uploadFile(bucketName, path, gzip, prefix);
64813+
const uploadedFile = yield uploader.uploadFile(bucketName, path, gzip, prefix, predefinedAcl);
6480864814
return [uploadedFile];
6480964815
}
6481064816
else {
64811-
const uploadedFiles = yield uploader.uploadDirectory(bucketName, path, gzip, prefix);
64817+
const uploadedFiles = yield uploader.uploadDirectory(bucketName, path, gzip, prefix, predefinedAcl);
6481264818
return uploadedFiles;
6481364819
}
6481464820
});

0 commit comments

Comments
 (0)