mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-22 00:11:02 -05:00
Fixed default value resolution for Modrinth/GitHub
This commit is contained in:
parent
01cdf5d731
commit
c218b813c0
2 changed files with 8 additions and 6 deletions
|
@ -1,9 +1,10 @@
|
||||||
import { GitHubUploadRequest as UploadRequest, GitHubUploadReport as UploadReport } from "@/action";
|
import { GitHubUploadReport as UploadReport, GitHubUploadRequest as UploadRequest } from "@/action";
|
||||||
import { GenericPlatformUploader, GenericPlatformUploaderOptions } from "@/platforms/generic-platform-uploader";
|
import { GenericPlatformUploader, GenericPlatformUploaderOptions } from "@/platforms/generic-platform-uploader";
|
||||||
import { PlatformType } from "@/platforms/platform-type";
|
import { PlatformType } from "@/platforms/platform-type";
|
||||||
import { GitHubContext } from "./github-context";
|
|
||||||
import { ArgumentNullError } from "@/utils/errors";
|
import { ArgumentNullError } from "@/utils/errors";
|
||||||
|
import { VersionType } from "@/utils/versioning";
|
||||||
import { GitHubApiClient } from "./github-api-client";
|
import { GitHubApiClient } from "./github-api-client";
|
||||||
|
import { GitHubContext } from "./github-context";
|
||||||
import { GitHubRelease } from "./github-release";
|
import { GitHubRelease } from "./github-release";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +71,7 @@ export class GitHubUploader extends GenericPlatformUploader<GitHubUploaderOption
|
||||||
repo: `${repo.owner}/${repo.repo}`,
|
repo: `${repo.owner}/${repo.repo}`,
|
||||||
tag: release.tag_name,
|
tag: release.tag_name,
|
||||||
url: release.html_url,
|
url: release.html_url,
|
||||||
files: release.assets.map(x => ({ id: x.id, name: x.name, url: x.url })),
|
files: release.assets.map(x => ({ id: x.id, name: x.name, url: x.browser_download_url })),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +105,9 @@ export class GitHubUploader extends GenericPlatformUploader<GitHubUploaderOption
|
||||||
name: request.name,
|
name: request.name,
|
||||||
body: request.changelog,
|
body: request.changelog,
|
||||||
draft: request.draft,
|
draft: request.draft,
|
||||||
prerelease: request.prerelease,
|
prerelease: request.prerelease ?? request.versionType !== VersionType.RELEASE,
|
||||||
discussion_category_name: request.discussion,
|
discussion_category_name: request.discussion,
|
||||||
generate_release_notes: request.generateChangelog,
|
generate_release_notes: request.generateChangelog ?? !request.changelog,
|
||||||
}))?.id;
|
}))?.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,10 +51,11 @@ export class ModrinthUploader extends GenericPlatformUploader<ModrinthUploaderOp
|
||||||
*/
|
*/
|
||||||
protected async uploadCore(request: ModrinthUploadRequest): Promise<ModrinthUploadReport> {
|
protected async uploadCore(request: ModrinthUploadRequest): Promise<ModrinthUploadReport> {
|
||||||
const api = new ModrinthApiClient({ token: request.token.unwrap() });
|
const api = new ModrinthApiClient({ token: request.token.unwrap() });
|
||||||
|
const unfeatureMode = request.unfeatureMode ?? request.featured ? ModrinthUnfeatureMode.SUBSET : ModrinthUnfeatureMode.NONE;
|
||||||
|
|
||||||
const project = await this.getProject(request.id, api);
|
const project = await this.getProject(request.id, api);
|
||||||
const version = await this.createVersion(request, project, api);
|
const version = await this.createVersion(request, project, api);
|
||||||
await this.unfeaturePreviousVersions(version, request.unfeatureMode, api);
|
await this.unfeaturePreviousVersions(version, unfeatureMode, api);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: project.id,
|
id: project.id,
|
||||||
|
|
Loading…
Reference in a new issue