Skip to content

Commit 13fee7b

Browse files
chore: build dist upload-cloud-storage (#16)
1 parent 2f6066a commit 13fee7b

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

dist/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5830,9 +5830,10 @@ function run() {
58305830
try {
58315831
const path = core.getInput('path', { required: true });
58325832
const destination = core.getInput('destination', { required: true });
5833+
const gzip = core.getInput('gzip', { required: false }) === 'false' ? false : true;
58335834
const serviceAccountKey = core.getInput('credentials');
58345835
const client = new client_1.Client({ credentials: serviceAccountKey });
5835-
const uploadResponses = yield client.upload(destination, path);
5836+
const uploadResponses = yield client.upload(destination, path, gzip);
58365837
core.setOutput('uploaded', uploadResponses
58375838
.map((uploadResponse) => uploadResponse[0].name)
58385839
.toString());
@@ -17513,9 +17514,9 @@ class UploadHelper {
1751317514
* @param destination The destination prefix.
1751417515
* @returns The UploadResponse which contains the file and metadata.
1751517516
*/
17516-
uploadFile(bucketName, filename, destination) {
17517+
uploadFile(bucketName, filename, gzip, destination) {
1751717518
return __awaiter(this, void 0, void 0, function* () {
17518-
const options = { gzip: true };
17519+
const options = { gzip };
1751917520
if (destination) {
1752017521
// If obj prefix is set, then extract filename and append to prefix.
1752117522
options.destination = `${destination}/${path.posix.basename(filename)}`;
@@ -17536,7 +17537,7 @@ class UploadHelper {
1753617537
* @param clearExistingFilesFirst Clean files in the prefix before uploading.
1753717538
* @returns The list of UploadResponses which contains the file and metadata.
1753817539
*/
17539-
uploadDirectory(bucketName, directoryPath, prefix = '') {
17540+
uploadDirectory(bucketName, directoryPath, gzip, prefix = '') {
1754017541
return __awaiter(this, void 0, void 0, function* () {
1754117542
const pathDirName = path.posix.dirname(directoryPath);
1754217543
// Get list of files in the directory.
@@ -17548,7 +17549,7 @@ class UploadHelper {
1754817549
if (prefix) {
1754917550
destination = `${prefix}/${destination}`;
1755017551
}
17551-
const uploadResp = yield this.uploadFile(bucketName, filePath, destination);
17552+
const uploadResp = yield this.uploadFile(bucketName, filePath, gzip, destination);
1755217553
return uploadResp;
1755317554
})));
1755417555
return resp;
@@ -64790,7 +64791,7 @@ class Client {
6479064791
* @param prefix Optional prefix when uploading to GCS.
6479164792
* @returns List of uploaded file(s).
6479264793
*/
64793-
upload(destination, path) {
64794+
upload(destination, path, gzip) {
6479464795
return __awaiter(this, void 0, void 0, function* () {
6479564796
let bucketName = destination;
6479664797
let prefix = '';
@@ -64803,11 +64804,11 @@ class Client {
6480364804
const stat = yield fs.promises.stat(path);
6480464805
const uploader = new upload_helper_1.UploadHelper(this.storage);
6480564806
if (stat.isFile()) {
64806-
const uploadedFile = yield uploader.uploadFile(bucketName, path, prefix);
64807+
const uploadedFile = yield uploader.uploadFile(bucketName, path, gzip, prefix);
6480764808
return [uploadedFile];
6480864809
}
6480964810
else {
64810-
const uploadedFiles = yield uploader.uploadDirectory(bucketName, path, prefix);
64811+
const uploadedFiles = yield uploader.uploadDirectory(bucketName, path, gzip, prefix);
6481164812
return uploadedFiles;
6481264813
}
6481364814
});

0 commit comments

Comments
 (0)