Update build artifacts

This commit is contained in:
Nick Cipollo
2021-10-03 18:47:56 -04:00
parent 95aae1ba96
commit 3e88dac4cf
4 changed files with 58 additions and 18 deletions

View File

@@ -31,10 +31,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.GithubArtifactUploader = void 0;
const core = __importStar(require("@actions/core"));
class GithubArtifactUploader {
constructor(releases, replacesExistingArtifacts = true, removeArtifacts = false, throwsUploadErrors = false) {
constructor(releases, replacesExistingArtifacts = true, throwsUploadErrors = false) {
this.releases = releases;
this.replacesExistingArtifacts = replacesExistingArtifacts;
this.removeArtifacts = removeArtifacts;
this.throwsUploadErrors = throwsUploadErrors;
}
uploadArtifacts(artifacts, releaseId, uploadUrl) {
@@ -42,9 +41,6 @@ class GithubArtifactUploader {
if (this.replacesExistingArtifacts) {
yield this.deleteUpdatedArtifacts(artifacts, releaseId);
}
if (this.removeArtifacts) {
yield this.deleteUploadedArtifacts(releaseId);
}
for (const artifact of artifacts) {
yield this.uploadArtifact(artifact, releaseId, uploadUrl);
}
@@ -88,15 +84,5 @@ class GithubArtifactUploader {
}
});
}
deleteUploadedArtifacts(releaseId) {
return __awaiter(this, void 0, void 0, function* () {
const releaseAssets = yield this.releases.listArtifactsForRelease(releaseId);
for (const artifact of releaseAssets) {
const asset = artifact;
core.debug(`Deleting existing artifact ${artifact.name}...`);
yield this.releases.deleteArtifact(asset.id);
}
});
}
}
exports.GithubArtifactUploader = GithubArtifactUploader;