Fix things
This commit is contained in:
@@ -8,8 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const path_1 = require("path");
|
|
||||||
const fs_1 = require("fs");
|
|
||||||
class Action {
|
class Action {
|
||||||
constructor(inputs, releases) {
|
constructor(inputs, releases) {
|
||||||
this.inputs = inputs;
|
this.inputs = inputs;
|
||||||
@@ -19,13 +17,10 @@ class Action {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
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);
|
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) {
|
if (this.inputs.artifact) {
|
||||||
const artifactData = this.readArtifact(this.inputs.artifact);
|
const artifactData = this.inputs.readArtifact();
|
||||||
yield this.releases.uploadArtifact(createResult.data.upload_url, this.inputs.artifactContentLength, this.inputs.artifactContentType, artifactData, path_1.basename(this.inputs.artifact));
|
yield this.releases.uploadArtifact(createResult.data.upload_url, this.inputs.artifactContentLength, this.inputs.artifactContentType, artifactData, this.inputs.artifactName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
readArtifact(path) {
|
|
||||||
return fs_1.readFileSync(path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports.Action = Action;
|
exports.Action = Action;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const fs_1 = require("fs");
|
const fs_1 = require("fs");
|
||||||
|
const path_1 = require("path");
|
||||||
class CoreInputs {
|
class CoreInputs {
|
||||||
constructor(context) {
|
constructor(context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@@ -16,6 +17,9 @@ class CoreInputs {
|
|||||||
get artifact() {
|
get artifact() {
|
||||||
return core.getInput('artifact');
|
return core.getInput('artifact');
|
||||||
}
|
}
|
||||||
|
get artifactName() {
|
||||||
|
return path_1.basename(this.artifact);
|
||||||
|
}
|
||||||
get artifactContentType() {
|
get artifactContentType() {
|
||||||
const type = core.getInput('artifactContentType');
|
const type = core.getInput('artifactContentType');
|
||||||
if (type) {
|
if (type) {
|
||||||
@@ -66,6 +70,9 @@ class CoreInputs {
|
|||||||
get token() {
|
get token() {
|
||||||
return core.getInput('token', { required: true });
|
return core.getInput('token', { required: true });
|
||||||
}
|
}
|
||||||
|
readArtifact() {
|
||||||
|
return fs_1.readFileSync(this.artifact);
|
||||||
|
}
|
||||||
stringFromFile(path) {
|
stringFromFile(path) {
|
||||||
return fs_1.readFileSync(path, 'utf-8');
|
return fs_1.readFileSync(path, 'utf-8');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user