Misc Download Artifact Improvements (#43)

* Various improvements to download-artifact

* Resolve input path

* README updates

* PR feedback
This commit is contained in:
Konrad Pabjan 2020-07-15 12:09:31 +02:00 committed by GitHub
parent 385ad92b52
commit 7e5b6f00de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 286 additions and 125 deletions

11
dist/index.js vendored
View file

@ -6581,6 +6581,10 @@ var Inputs;
Inputs["Name"] = "name";
Inputs["Path"] = "path";
})(Inputs = exports.Inputs || (exports.Inputs = {}));
var Outputs;
(function (Outputs) {
Outputs["DownloadPath"] = "download-path";
})(Outputs = exports.Outputs || (exports.Outputs = {}));
/***/ }),
@ -6630,6 +6634,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const artifact = __importStar(__webpack_require__(214));
const path_1 = __webpack_require__(622);
const constants_1 = __webpack_require__(694);
function run() {
return __awaiter(this, void 0, void 0, function* () {
@ -6639,6 +6644,8 @@ function run() {
const artifactClient = artifact.create();
if (!name) {
// 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(path);
core.info(`There were ${downloadResponse.length} artifacts downloaded`);
for (const artifact of downloadResponse) {
@ -6647,12 +6654,16 @@ function run() {
}
else {
// download a single artifact
core.info(`Starting download for ${name}`);
const downloadOptions = {
createArtifactFolder: false
};
const downloadResponse = yield artifactClient.downloadArtifact(name, path, downloadOptions);
core.info(`Artifact ${downloadResponse.artifactName} was downloaded to ${downloadResponse.downloadPath}`);
}
// output the directory that the artifact(s) was/were downloaded to
// if no path is provided, an empty string resolves to the current working directory
core.setOutput(constants_1.Outputs.DownloadPath, path_1.resolve(path));
core.info('Artifact download has finished successfully');
}
catch (err) {