Update typescript config
This commit is contained in:
484
dist/index.js
vendored
484
dist/index.js
vendored
@@ -29,21 +29,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.Action = void 0;
|
exports.Action = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(1401));
|
const core = __importStar(__nccwpck_require__(1401));
|
||||||
const GithubError_1 = __nccwpck_require__(6336);
|
const GithubError_1 = __nccwpck_require__(6336);
|
||||||
const ReleaseValidator_1 = __nccwpck_require__(3315);
|
const ReleaseValidator_1 = __nccwpck_require__(3315);
|
||||||
class Action {
|
class Action {
|
||||||
|
inputs;
|
||||||
|
outputs;
|
||||||
|
releases;
|
||||||
|
uploader;
|
||||||
|
artifactDestroyer;
|
||||||
|
skipper;
|
||||||
|
releaseValidator;
|
||||||
constructor(inputs, outputs, releases, uploader, artifactDestroyer, skipper) {
|
constructor(inputs, outputs, releases, uploader, artifactDestroyer, skipper) {
|
||||||
this.inputs = inputs;
|
this.inputs = inputs;
|
||||||
this.outputs = outputs;
|
this.outputs = outputs;
|
||||||
@@ -53,88 +51,74 @@ class Action {
|
|||||||
this.skipper = skipper;
|
this.skipper = skipper;
|
||||||
this.releaseValidator = new ReleaseValidator_1.ReleaseValidator(inputs.updateOnlyUnreleased);
|
this.releaseValidator = new ReleaseValidator_1.ReleaseValidator(inputs.updateOnlyUnreleased);
|
||||||
}
|
}
|
||||||
perform() {
|
async perform() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (await this.skipper.shouldSkip()) {
|
||||||
if (yield this.skipper.shouldSkip()) {
|
core.notice("Skipping action, release already exists and skipIfReleaseExists is enabled.");
|
||||||
core.notice("Skipping action, release already exists and skipIfReleaseExists is enabled.");
|
return;
|
||||||
return;
|
}
|
||||||
}
|
const releaseResponse = await this.createOrUpdateRelease();
|
||||||
const releaseResponse = yield this.createOrUpdateRelease();
|
const releaseData = releaseResponse.data;
|
||||||
const releaseData = releaseResponse.data;
|
const releaseId = releaseData.id;
|
||||||
const releaseId = releaseData.id;
|
const uploadUrl = releaseData.upload_url;
|
||||||
const uploadUrl = releaseData.upload_url;
|
if (this.inputs.removeArtifacts) {
|
||||||
if (this.inputs.removeArtifacts) {
|
await this.artifactDestroyer.destroyArtifacts(releaseId);
|
||||||
yield this.artifactDestroyer.destroyArtifacts(releaseId);
|
}
|
||||||
}
|
const artifacts = this.inputs.artifacts;
|
||||||
const artifacts = this.inputs.artifacts;
|
if (artifacts.length > 0) {
|
||||||
if (artifacts.length > 0) {
|
await this.uploader.uploadArtifacts(artifacts, releaseId, uploadUrl);
|
||||||
yield this.uploader.uploadArtifacts(artifacts, releaseId, uploadUrl);
|
}
|
||||||
}
|
this.outputs.applyReleaseData(releaseData);
|
||||||
this.outputs.applyReleaseData(releaseData);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
createOrUpdateRelease() {
|
async createOrUpdateRelease() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (this.inputs.allowUpdates) {
|
||||||
if (this.inputs.allowUpdates) {
|
let getResponse;
|
||||||
let getResponse;
|
try {
|
||||||
try {
|
getResponse = await this.releases.getByTag(this.inputs.tag);
|
||||||
getResponse = yield this.releases.getByTag(this.inputs.tag);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return yield this.checkForMissingReleaseError(error);
|
|
||||||
}
|
|
||||||
// Fail if this isn't an unreleased release & updateOnlyUnreleased is enabled.
|
|
||||||
this.releaseValidator.validateReleaseUpdate(getResponse.data);
|
|
||||||
return yield this.updateRelease(getResponse.data.id);
|
|
||||||
}
|
}
|
||||||
else {
|
catch (error) {
|
||||||
return yield this.createRelease();
|
return await this.checkForMissingReleaseError(error);
|
||||||
}
|
}
|
||||||
});
|
// Fail if this isn't an unreleased release & updateOnlyUnreleased is enabled.
|
||||||
|
this.releaseValidator.validateReleaseUpdate(getResponse.data);
|
||||||
|
return await this.updateRelease(getResponse.data.id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return await this.createRelease();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
checkForMissingReleaseError(error) {
|
async checkForMissingReleaseError(error) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (Action.noPublishedRelease(error)) {
|
||||||
if (Action.noPublishedRelease(error)) {
|
return await this.updateDraftOrCreateRelease();
|
||||||
return yield this.updateDraftOrCreateRelease();
|
}
|
||||||
}
|
else {
|
||||||
else {
|
throw error;
|
||||||
throw error;
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
updateRelease(id) {
|
async updateRelease(id) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return await this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.updatedDraft, this.inputs.makeLatest, this.inputs.updatedReleaseName, this.inputs.updatedPrerelease);
|
||||||
return yield this.releases.update(id, this.inputs.tag, this.inputs.updatedReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.updatedDraft, this.inputs.makeLatest, this.inputs.updatedReleaseName, this.inputs.updatedPrerelease);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
static noPublishedRelease(error) {
|
static noPublishedRelease(error) {
|
||||||
const githubError = new GithubError_1.GithubError(error);
|
const githubError = new GithubError_1.GithubError(error);
|
||||||
return githubError.status == 404;
|
return githubError.status == 404;
|
||||||
}
|
}
|
||||||
updateDraftOrCreateRelease() {
|
async updateDraftOrCreateRelease() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const draftReleaseId = await this.findMatchingDraftReleaseId();
|
||||||
const draftReleaseId = yield this.findMatchingDraftReleaseId();
|
if (draftReleaseId) {
|
||||||
if (draftReleaseId) {
|
return await this.updateRelease(draftReleaseId);
|
||||||
return yield this.updateRelease(draftReleaseId);
|
}
|
||||||
}
|
else {
|
||||||
else {
|
return await this.createRelease();
|
||||||
return yield this.createRelease();
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
findMatchingDraftReleaseId() {
|
async findMatchingDraftReleaseId() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const tag = this.inputs.tag;
|
||||||
const tag = this.inputs.tag;
|
const response = await this.releases.listReleases();
|
||||||
const response = yield this.releases.listReleases();
|
const releases = response.data;
|
||||||
const releases = response.data;
|
const draftRelease = releases.find(release => release.draft && release.tag_name == tag);
|
||||||
const draftRelease = releases.find(release => release.draft && release.tag_name == tag);
|
return draftRelease?.id;
|
||||||
return draftRelease === null || draftRelease === void 0 ? void 0 : draftRelease.id;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
createRelease() {
|
async createRelease() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return await this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.createdDraft, this.inputs.generateReleaseNotes, this.inputs.makeLatest, this.inputs.createdReleaseName, this.inputs.createdPrerelease);
|
||||||
return yield this.releases.create(this.inputs.tag, this.inputs.createdReleaseBody, this.inputs.commit, this.inputs.discussionCategory, this.inputs.createdDraft, this.inputs.generateReleaseNotes, this.inputs.makeLatest, this.inputs.createdReleaseName, this.inputs.createdPrerelease);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Action = Action;
|
exports.Action = Action;
|
||||||
@@ -143,42 +127,34 @@ exports.Action = Action;
|
|||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 1223:
|
/***/ 1223:
|
||||||
/***/ (function(__unused_webpack_module, exports) {
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.ReleaseActionSkipper = void 0;
|
exports.ReleaseActionSkipper = void 0;
|
||||||
class ReleaseActionSkipper {
|
class ReleaseActionSkipper {
|
||||||
|
skipIfReleaseExists;
|
||||||
|
releases;
|
||||||
|
tag;
|
||||||
constructor(skipIfReleaseExists, releases, tag) {
|
constructor(skipIfReleaseExists, releases, tag) {
|
||||||
this.skipIfReleaseExists = skipIfReleaseExists;
|
this.skipIfReleaseExists = skipIfReleaseExists;
|
||||||
this.releases = releases;
|
this.releases = releases;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
shouldSkip() {
|
async shouldSkip() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (!this.skipIfReleaseExists) {
|
||||||
if (!this.skipIfReleaseExists) {
|
// Bail if skip flag isn't set.
|
||||||
// Bail if skip flag isn't set.
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
try {
|
||||||
try {
|
const getResponse = await this.releases.getByTag(this.tag);
|
||||||
const getResponse = yield this.releases.getByTag(this.tag);
|
return getResponse.data != null;
|
||||||
return getResponse.data != null;
|
}
|
||||||
}
|
catch (error) {
|
||||||
catch (error) {
|
// There is either no release or something else went wrong. Either way, run the action.
|
||||||
// There is either no release or something else went wrong. Either way, run the action.
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ReleaseActionSkipper = ReleaseActionSkipper;
|
exports.ReleaseActionSkipper = ReleaseActionSkipper;
|
||||||
@@ -196,6 +172,9 @@ exports.Artifact = void 0;
|
|||||||
const path_1 = __nccwpck_require__(1017);
|
const path_1 = __nccwpck_require__(1017);
|
||||||
const fs_1 = __nccwpck_require__(7147);
|
const fs_1 = __nccwpck_require__(7147);
|
||||||
class Artifact {
|
class Artifact {
|
||||||
|
contentType;
|
||||||
|
name;
|
||||||
|
path;
|
||||||
constructor(path, contentType = "raw") {
|
constructor(path, contentType = "raw") {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.name = (0, path_1.basename)(path);
|
this.name = (0, path_1.basename)(path);
|
||||||
@@ -241,31 +220,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.GithubArtifactDestroyer = void 0;
|
exports.GithubArtifactDestroyer = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(1401));
|
const core = __importStar(__nccwpck_require__(1401));
|
||||||
class GithubArtifactDestroyer {
|
class GithubArtifactDestroyer {
|
||||||
|
releases;
|
||||||
constructor(releases) {
|
constructor(releases) {
|
||||||
this.releases = releases;
|
this.releases = releases;
|
||||||
}
|
}
|
||||||
destroyArtifacts(releaseId) {
|
async destroyArtifacts(releaseId) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const releaseAssets = await this.releases.listArtifactsForRelease(releaseId);
|
||||||
const releaseAssets = yield this.releases.listArtifactsForRelease(releaseId);
|
for (const artifact of releaseAssets) {
|
||||||
for (const artifact of releaseAssets) {
|
const asset = artifact;
|
||||||
const asset = artifact;
|
core.debug(`Deleting existing artifact ${artifact.name}...`);
|
||||||
core.debug(`Deleting existing artifact ${artifact.name}...`);
|
await this.releases.deleteArtifact(asset.id);
|
||||||
yield this.releases.deleteArtifact(asset.id);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.GithubArtifactDestroyer = GithubArtifactDestroyer;
|
exports.GithubArtifactDestroyer = GithubArtifactDestroyer;
|
||||||
@@ -313,6 +282,7 @@ const untildify_1 = __importDefault(__nccwpck_require__(9555));
|
|||||||
const ArtifactPathValidator_1 = __nccwpck_require__(2578);
|
const ArtifactPathValidator_1 = __nccwpck_require__(2578);
|
||||||
const PathNormalizer_1 = __nccwpck_require__(9888);
|
const PathNormalizer_1 = __nccwpck_require__(9888);
|
||||||
class FileArtifactGlobber {
|
class FileArtifactGlobber {
|
||||||
|
globber;
|
||||||
constructor(globber = new Globber_1.FileGlobber()) {
|
constructor(globber = new Globber_1.FileGlobber()) {
|
||||||
this.globber = globber;
|
this.globber = globber;
|
||||||
}
|
}
|
||||||
@@ -391,6 +361,9 @@ exports.ArtifactPathValidator = void 0;
|
|||||||
const core = __importStar(__nccwpck_require__(1401));
|
const core = __importStar(__nccwpck_require__(1401));
|
||||||
const fs_1 = __nccwpck_require__(7147);
|
const fs_1 = __nccwpck_require__(7147);
|
||||||
class ArtifactPathValidator {
|
class ArtifactPathValidator {
|
||||||
|
errorsFailBuild;
|
||||||
|
paths;
|
||||||
|
pattern;
|
||||||
constructor(errorsFailBuild, paths, pattern) {
|
constructor(errorsFailBuild, paths, pattern) {
|
||||||
this.paths = paths;
|
this.paths = paths;
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
@@ -456,71 +429,59 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.GithubArtifactUploader = void 0;
|
exports.GithubArtifactUploader = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(1401));
|
const core = __importStar(__nccwpck_require__(1401));
|
||||||
class GithubArtifactUploader {
|
class GithubArtifactUploader {
|
||||||
|
releases;
|
||||||
|
replacesExistingArtifacts;
|
||||||
|
throwsUploadErrors;
|
||||||
constructor(releases, replacesExistingArtifacts = true, throwsUploadErrors = false) {
|
constructor(releases, replacesExistingArtifacts = true, throwsUploadErrors = false) {
|
||||||
this.releases = releases;
|
this.releases = releases;
|
||||||
this.replacesExistingArtifacts = replacesExistingArtifacts;
|
this.replacesExistingArtifacts = replacesExistingArtifacts;
|
||||||
this.throwsUploadErrors = throwsUploadErrors;
|
this.throwsUploadErrors = throwsUploadErrors;
|
||||||
}
|
}
|
||||||
uploadArtifacts(artifacts, releaseId, uploadUrl) {
|
async uploadArtifacts(artifacts, releaseId, uploadUrl) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (this.replacesExistingArtifacts) {
|
||||||
if (this.replacesExistingArtifacts) {
|
await this.deleteUpdatedArtifacts(artifacts, releaseId);
|
||||||
yield this.deleteUpdatedArtifacts(artifacts, releaseId);
|
}
|
||||||
}
|
for (const artifact of artifacts) {
|
||||||
for (const artifact of artifacts) {
|
await this.uploadArtifact(artifact, releaseId, uploadUrl);
|
||||||
yield this.uploadArtifact(artifact, releaseId, uploadUrl);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
uploadArtifact(artifact, releaseId, uploadUrl, retry = 3) {
|
async uploadArtifact(artifact, releaseId, uploadUrl, retry = 3) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
try {
|
||||||
try {
|
core.debug(`Uploading artifact ${artifact.name}...`);
|
||||||
core.debug(`Uploading artifact ${artifact.name}...`);
|
await this.releases.uploadArtifact(uploadUrl, artifact.contentLength, artifact.contentType, artifact.readFile(), artifact.name, releaseId);
|
||||||
yield this.releases.uploadArtifact(uploadUrl, artifact.contentLength, artifact.contentType, artifact.readFile(), artifact.name, releaseId);
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (error.status >= 500 && retry > 0) {
|
||||||
|
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}. Retrying...`);
|
||||||
|
await this.uploadArtifact(artifact, releaseId, uploadUrl, retry - 1);
|
||||||
}
|
}
|
||||||
catch (error) {
|
else {
|
||||||
if (error.status >= 500 && retry > 0) {
|
if (this.throwsUploadErrors) {
|
||||||
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}. Retrying...`);
|
throw Error(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
|
||||||
yield this.uploadArtifact(artifact, releaseId, uploadUrl, retry - 1);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.throwsUploadErrors) {
|
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
|
||||||
throw Error(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.warning(`Failed to upload artifact ${artifact.name}. ${error.message}.`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
deleteUpdatedArtifacts(artifacts, releaseId) {
|
async deleteUpdatedArtifacts(artifacts, releaseId) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
const releaseAssets = await this.releases.listArtifactsForRelease(releaseId);
|
||||||
const releaseAssets = yield this.releases.listArtifactsForRelease(releaseId);
|
const assetByName = {};
|
||||||
const assetByName = {};
|
releaseAssets.forEach(asset => {
|
||||||
releaseAssets.forEach(asset => {
|
assetByName[asset.name] = asset;
|
||||||
assetByName[asset.name] = asset;
|
|
||||||
});
|
|
||||||
for (const artifact of artifacts) {
|
|
||||||
const asset = assetByName[artifact.name];
|
|
||||||
if (asset) {
|
|
||||||
core.debug(`Deleting existing artifact ${artifact.name}...`);
|
|
||||||
yield this.releases.deleteArtifact(asset.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
for (const artifact of artifacts) {
|
||||||
|
const asset = assetByName[artifact.name];
|
||||||
|
if (asset) {
|
||||||
|
core.debug(`Deleting existing artifact ${artifact.name}...`);
|
||||||
|
await this.releases.deleteArtifact(asset.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.GithubArtifactUploader = GithubArtifactUploader;
|
exports.GithubArtifactUploader = GithubArtifactUploader;
|
||||||
@@ -537,6 +498,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.GithubError = void 0;
|
exports.GithubError = void 0;
|
||||||
const GithubErrorDetail_1 = __nccwpck_require__(697);
|
const GithubErrorDetail_1 = __nccwpck_require__(697);
|
||||||
class GithubError {
|
class GithubError {
|
||||||
|
error;
|
||||||
|
githubErrors;
|
||||||
constructor(error) {
|
constructor(error) {
|
||||||
this.error = error;
|
this.error = error;
|
||||||
this.githubErrors = this.generateGithubErrors();
|
this.githubErrors = this.generateGithubErrors();
|
||||||
@@ -590,6 +553,7 @@ exports.GithubError = GithubError;
|
|||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.GithubErrorDetail = void 0;
|
exports.GithubErrorDetail = void 0;
|
||||||
class GithubErrorDetail {
|
class GithubErrorDetail {
|
||||||
|
error;
|
||||||
constructor(error) {
|
constructor(error) {
|
||||||
this.error = error;
|
this.error = error;
|
||||||
}
|
}
|
||||||
@@ -698,6 +662,8 @@ exports.CoreInputs = void 0;
|
|||||||
const core = __importStar(__nccwpck_require__(1401));
|
const core = __importStar(__nccwpck_require__(1401));
|
||||||
const fs_1 = __nccwpck_require__(7147);
|
const fs_1 = __nccwpck_require__(7147);
|
||||||
class CoreInputs {
|
class CoreInputs {
|
||||||
|
artifactGlobber;
|
||||||
|
context;
|
||||||
constructor(artifactGlobber, context) {
|
constructor(artifactGlobber, context) {
|
||||||
this.artifactGlobber = artifactGlobber;
|
this.artifactGlobber = artifactGlobber;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@@ -944,16 +910,16 @@ exports.PathNormalizer = PathNormalizer;
|
|||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.ReleaseValidator = void 0;
|
exports.ReleaseValidator = void 0;
|
||||||
class ReleaseValidator {
|
class ReleaseValidator {
|
||||||
|
updateOnlyUnreleased;
|
||||||
constructor(updateOnlyUnreleased) {
|
constructor(updateOnlyUnreleased) {
|
||||||
this.updateOnlyUnreleased = updateOnlyUnreleased;
|
this.updateOnlyUnreleased = updateOnlyUnreleased;
|
||||||
}
|
}
|
||||||
validateReleaseUpdate(releaseResponse) {
|
validateReleaseUpdate(releaseResponse) {
|
||||||
var _a;
|
|
||||||
if (!this.updateOnlyUnreleased) {
|
if (!this.updateOnlyUnreleased) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!releaseResponse.draft && !releaseResponse.prerelease) {
|
if (!releaseResponse.draft && !releaseResponse.prerelease) {
|
||||||
throw new Error(`Tried to update "${(_a = releaseResponse.name) !== null && _a !== void 0 ? _a : "release"}" which is neither a draft or prerelease. (updateOnlyUnreleased is on)`);
|
throw new Error(`Tried to update "${releaseResponse.name ?? "release"}" which is neither a draft or prerelease. (updateOnlyUnreleased is on)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -963,111 +929,90 @@ exports.ReleaseValidator = ReleaseValidator;
|
|||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 1495:
|
/***/ 1495:
|
||||||
/***/ (function(__unused_webpack_module, exports) {
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.GithubReleases = void 0;
|
exports.GithubReleases = void 0;
|
||||||
class GithubReleases {
|
class GithubReleases {
|
||||||
|
git;
|
||||||
|
inputs;
|
||||||
constructor(inputs, git) {
|
constructor(inputs, git) {
|
||||||
this.inputs = inputs;
|
this.inputs = inputs;
|
||||||
this.git = git;
|
this.git = git;
|
||||||
}
|
}
|
||||||
create(tag, body, commitHash, discussionCategory, draft, generateReleaseNotes, makeLatest, name, prerelease) {
|
async create(tag, body, commitHash, discussionCategory, draft, generateReleaseNotes, makeLatest, name, prerelease) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
// noinspection TypeScriptValidateJSTypes
|
||||||
// noinspection TypeScriptValidateJSTypes
|
return this.git.rest.repos.createRelease({
|
||||||
return this.git.rest.repos.createRelease({
|
body: body,
|
||||||
body: body,
|
name: name,
|
||||||
name: name,
|
discussion_category_name: discussionCategory,
|
||||||
discussion_category_name: discussionCategory,
|
draft: draft,
|
||||||
draft: draft,
|
generate_release_notes: generateReleaseNotes,
|
||||||
generate_release_notes: generateReleaseNotes,
|
make_latest: makeLatest,
|
||||||
make_latest: makeLatest,
|
owner: this.inputs.owner,
|
||||||
owner: this.inputs.owner,
|
prerelease: prerelease,
|
||||||
prerelease: prerelease,
|
repo: this.inputs.repo,
|
||||||
repo: this.inputs.repo,
|
target_commitish: commitHash,
|
||||||
target_commitish: commitHash,
|
tag_name: tag
|
||||||
tag_name: tag
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
deleteArtifact(assetId) {
|
async deleteArtifact(assetId) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return this.git.rest.repos.deleteReleaseAsset({
|
||||||
return this.git.rest.repos.deleteReleaseAsset({
|
asset_id: assetId,
|
||||||
asset_id: assetId,
|
owner: this.inputs.owner,
|
||||||
owner: this.inputs.owner,
|
repo: this.inputs.repo
|
||||||
repo: this.inputs.repo
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getByTag(tag) {
|
async getByTag(tag) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return this.git.rest.repos.getReleaseByTag({
|
||||||
return this.git.rest.repos.getReleaseByTag({
|
owner: this.inputs.owner,
|
||||||
owner: this.inputs.owner,
|
repo: this.inputs.repo,
|
||||||
repo: this.inputs.repo,
|
tag: tag
|
||||||
tag: tag
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
listArtifactsForRelease(releaseId) {
|
async listArtifactsForRelease(releaseId) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return this.git.paginate(this.git.rest.repos.listReleaseAssets, {
|
||||||
return this.git.paginate(this.git.rest.repos.listReleaseAssets, {
|
owner: this.inputs.owner,
|
||||||
owner: this.inputs.owner,
|
release_id: releaseId,
|
||||||
release_id: releaseId,
|
repo: this.inputs.repo
|
||||||
repo: this.inputs.repo
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
listReleases() {
|
async listReleases() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return this.git.rest.repos.listReleases({
|
||||||
return this.git.rest.repos.listReleases({
|
owner: this.inputs.owner,
|
||||||
owner: this.inputs.owner,
|
repo: this.inputs.repo
|
||||||
repo: this.inputs.repo
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
update(id, tag, body, commitHash, discussionCategory, draft, makeLatest, name, prerelease) {
|
async update(id, tag, body, commitHash, discussionCategory, draft, makeLatest, name, prerelease) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
// noinspection TypeScriptValidateJSTypes
|
||||||
// noinspection TypeScriptValidateJSTypes
|
return this.git.rest.repos.updateRelease({
|
||||||
return this.git.rest.repos.updateRelease({
|
release_id: id,
|
||||||
release_id: id,
|
body: body,
|
||||||
body: body,
|
name: name,
|
||||||
name: name,
|
discussion_category_name: discussionCategory,
|
||||||
discussion_category_name: discussionCategory,
|
draft: draft,
|
||||||
draft: draft,
|
make_latest: makeLatest,
|
||||||
make_latest: makeLatest,
|
owner: this.inputs.owner,
|
||||||
owner: this.inputs.owner,
|
prerelease: prerelease,
|
||||||
prerelease: prerelease,
|
repo: this.inputs.repo,
|
||||||
repo: this.inputs.repo,
|
target_commitish: commitHash,
|
||||||
target_commitish: commitHash,
|
tag_name: tag
|
||||||
tag_name: tag
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
uploadArtifact(assetUrl, contentLength, contentType, file, name, releaseId) {
|
async uploadArtifact(assetUrl, contentLength, contentType, file, name, releaseId) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return this.git.rest.repos.uploadReleaseAsset({
|
||||||
return this.git.rest.repos.uploadReleaseAsset({
|
url: assetUrl,
|
||||||
url: assetUrl,
|
headers: {
|
||||||
headers: {
|
"content-length": contentLength,
|
||||||
"content-length": contentLength,
|
"content-type": contentType
|
||||||
"content-type": contentType
|
},
|
||||||
},
|
data: file,
|
||||||
data: file,
|
name: name,
|
||||||
name: name,
|
owner: this.inputs.owner,
|
||||||
owner: this.inputs.owner,
|
release_id: releaseId,
|
||||||
release_id: releaseId,
|
repo: this.inputs.repo
|
||||||
repo: this.inputs.repo
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1104,15 +1049,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const github = __importStar(__nccwpck_require__(2215));
|
const github = __importStar(__nccwpck_require__(2215));
|
||||||
const core = __importStar(__nccwpck_require__(1401));
|
const core = __importStar(__nccwpck_require__(1401));
|
||||||
@@ -1125,17 +1061,15 @@ const GithubError_1 = __nccwpck_require__(6336);
|
|||||||
const Outputs_1 = __nccwpck_require__(8811);
|
const Outputs_1 = __nccwpck_require__(8811);
|
||||||
const ArtifactDestroyer_1 = __nccwpck_require__(3633);
|
const ArtifactDestroyer_1 = __nccwpck_require__(3633);
|
||||||
const ActionSkipper_1 = __nccwpck_require__(1223);
|
const ActionSkipper_1 = __nccwpck_require__(1223);
|
||||||
function run() {
|
async function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
try {
|
||||||
try {
|
const action = createAction();
|
||||||
const action = createAction();
|
await action.perform();
|
||||||
yield action.perform();
|
}
|
||||||
}
|
catch (error) {
|
||||||
catch (error) {
|
const githubError = new GithubError_1.GithubError(error);
|
||||||
const githubError = new GithubError_1.GithubError(error);
|
core.setFailed(githubError.toString());
|
||||||
core.setFailed(githubError.toString());
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
function createAction() {
|
function createAction() {
|
||||||
const token = core.getInput('token');
|
const token = core.getInput('token');
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"target": "ES2022",
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
"module": "NodeNext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "NodeNext",
|
||||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
|
|||||||
Reference in New Issue
Block a user