Fixes #1 Allow for multiple artifacts

This commit is contained in:
Nick Cipollo
2019-09-02 17:20:04 -04:00
parent 261c1fc08b
commit a698287254
24 changed files with 462 additions and 167 deletions

View File

@@ -9,16 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", { value: true });
class Action {
constructor(inputs, releases) {
constructor(inputs, releases, uploader) {
this.inputs = inputs;
this.releases = releases;
this.uploader = uploader;
}
perform() {
return __awaiter(this, void 0, void 0, function* () {
const createResult = yield this.releases.create(this.inputs.tag, this.inputs.body, this.inputs.commit, this.inputs.draft, this.inputs.name);
if (this.inputs.artifact) {
const artifactData = this.inputs.readArtifact();
yield this.releases.uploadArtifact(createResult.data.upload_url, this.inputs.artifactContentLength, this.inputs.artifactContentType, artifactData, this.inputs.artifactName);
const artifacts = this.inputs.artifacts;
if (artifacts.length > 0) {
yield this.uploader.uploadArtifacts(artifacts, createResult.data.upload_url);
}
});
}