diff --git a/dist/index.js b/dist/index.js index 648a1b7..eda2d70 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3944,7 +3944,7 @@ Note: The size of downloaded zips can differ significantly from the reported siz return uploadResponse; }); } - downloadArtifact(name, path, options, stayGzipped) { + downloadArtifact(name, path, options, extractArtifact) { return __awaiter(this, void 0, void 0, function* () { const downloadHttpClient = new download_http_client_1.DownloadHttpClient(); const artifacts = yield downloadHttpClient.listArtifacts(); @@ -3973,7 +3973,7 @@ Note: The size of downloaded zips can differ significantly from the reported siz yield utils_1.createDirectoriesForArtifact(downloadSpecification.directoryStructure); core.info('Directory structure has been setup for the artifact'); yield utils_1.createEmptyFilesForArtifact(downloadSpecification.emptyFilesToCreate); - yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload, stayGzipped); + yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload, extractArtifact); } return { artifactName: name, @@ -3981,7 +3981,7 @@ Note: The size of downloaded zips can differ significantly from the reported siz }; }); } - downloadAllArtifacts(path, stayGzipped) { + downloadAllArtifacts(path, extractArtifact) { return __awaiter(this, void 0, void 0, function* () { const downloadHttpClient = new download_http_client_1.DownloadHttpClient(); const response = []; @@ -4009,7 +4009,7 @@ Note: The size of downloaded zips can differ significantly from the reported siz else { yield utils_1.createDirectoriesForArtifact(downloadSpecification.directoryStructure); yield utils_1.createEmptyFilesForArtifact(downloadSpecification.emptyFilesToCreate); - yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload, stayGzipped); + yield downloadHttpClient.downloadSingleArtifact(downloadSpecification.filesToDownload, extractArtifact); } response.push({ artifactName: currentArtifactToDownload.name, @@ -6954,7 +6954,7 @@ var Inputs; (function (Inputs) { Inputs["Name"] = "name"; Inputs["Path"] = "path"; - Inputs["stayGzipped"] = "staygzipped"; + Inputs["Extract"] = "extract"; })(Inputs = exports.Inputs || (exports.Inputs = {})); var Outputs; (function (Outputs) { @@ -7010,7 +7010,7 @@ function run() { try { const name = core.getInput(constants_1.Inputs.Name, { required: false }); const path = core.getInput(constants_1.Inputs.Path, { required: false }); - const stayGzipped = core.getInput(constants_1.Inputs.stayGzipped, { required: false }); + const extractArtifact = core.getInput(constants_1.Inputs.Extract, { required: false, default: True }); let resolvedPath; // resolve tilde expansions, path.replace only replaces the first occurrence of a pattern if (path.startsWith(`~`)) { @@ -7025,7 +7025,7 @@ function run() { // download all artifacts core.info('No artifact name specified, downloading all artifacts'); core.info('Creating an extra directory for each artifact that is being downloaded'); - const downloadResponse = yield artifactClient.downloadAllArtifacts(resolvedPath, stayGzipped); + const downloadResponse = yield artifactClient.downloadAllArtifacts(resolvedPath, extractArtifact); core.info(`There were ${downloadResponse.length} artifacts downloaded`); for (const artifact of downloadResponse) { core.info(`Artifact ${artifact.artifactName} was downloaded to ${artifact.downloadPath}`); @@ -7037,7 +7037,7 @@ function run() { const downloadOptions = { createArtifactFolder: false }; - const downloadResponse = yield artifactClient.downloadArtifact(name, resolvedPath, downloadOptions, stayGzipped); + const downloadResponse = yield artifactClient.downloadArtifact(name, resolvedPath, downloadOptions, extractArtifact); core.info(`Artifact ${downloadResponse.artifactName} was downloaded to ${downloadResponse.downloadPath}`); } // output the directory that the artifact(s) was/were downloaded to @@ -7149,7 +7149,7 @@ class DownloadHttpClient { * Concurrently downloads all the files that are part of an artifact * @param downloadItems information about what items to download and where to save them */ - downloadSingleArtifact(downloadItems, stayGzipped) { + downloadSingleArtifact(downloadItems, extractArtifact) { return __awaiter(this, void 0, void 0, function* () { const DOWNLOAD_CONCURRENCY = config_variables_1.getDownloadFileConcurrency(); // limit the number of files downloaded at a single time @@ -7165,7 +7165,7 @@ class DownloadHttpClient { const currentFileToDownload = downloadItems[currentFile]; currentFile += 1; const startTime = perf_hooks_1.performance.now(); - yield this.downloadIndividualFile(index, currentFileToDownload.sourceLocation, currentFileToDownload.targetPath, stayGzipped); + yield this.downloadIndividualFile(index, currentFileToDownload.sourceLocation, currentFileToDownload.targetPath, extractArtifact); if (core.isDebug()) { core.debug(`File: ${++downloadedFiles}/${downloadItems.length}. ${currentFileToDownload.targetPath} took ${(perf_hooks_1.performance.now() - startTime).toFixed(3)} milliseconds to finish downloading`); } @@ -7188,7 +7188,7 @@ class DownloadHttpClient { * @param artifactLocation origin location where a file will be downloaded from * @param downloadPath destination location for the file being downloaded */ - downloadIndividualFile(httpClientIndex, artifactLocation, downloadPath, stayGzipped) { + downloadIndividualFile(httpClientIndex, artifactLocation, downloadPath, extractArtifact) { return __awaiter(this, void 0, void 0, function* () { let retryCount = 0; const retryLimit = config_variables_1.getRetryLimit(); @@ -7265,7 +7265,7 @@ class DownloadHttpClient { // Instead of using response.readBody(), response.message is a readableStream that can be directly used to get the raw body contents try { const isGzipped = isGzip(response.message.headers); - yield this.pipeResponseToFile(response, destinationStream, stayGzipped); + yield this.pipeResponseToFile(response, destinationStream, extractArtifact); if (isGzipped || isAllBytesReceived(response.message.headers['content-length'], yield utils_1.getFileSize(downloadPath))) { return; @@ -7301,10 +7301,10 @@ class DownloadHttpClient { * @param destinationStream the stream where the file should be written to * @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it */ - pipeResponseToFile(response, destinationStream, isGzip, stayGzipped) { + pipeResponseToFile(response, destinationStream, isGzip, extractArtifact) { return __awaiter(this, void 0, void 0, function* () { yield new Promise((resolve, reject) => { - if (isGzip && !stayGzipped) { + if (isGzip && extractArtifact) { const gunzip = zlib.createGunzip(); response.message .on('error', error => {