diff --git a/.changeset/clean-trainers-talk.md b/.changeset/clean-trainers-talk.md new file mode 100644 index 00000000000..833d616f7c7 --- /dev/null +++ b/.changeset/clean-trainers-talk.md @@ -0,0 +1,5 @@ +--- +"electron-updater": patch +--- + +add custom channel in github provider diff --git a/packages/electron-updater/src/providers/GitHubProvider.ts b/packages/electron-updater/src/providers/GitHubProvider.ts index 1b15b6ff71c..a91cf6be4ae 100644 --- a/packages/electron-updater/src/providers/GitHubProvider.ts +++ b/packages/electron-updater/src/providers/GitHubProvider.ts @@ -48,6 +48,11 @@ export class GitHubProvider extends BaseGitHubProvider { super(options, "github.com", runtimeOptions) } + private get channel(): string { + const result = this.updater.channel || this.options.channel + return result == null ? this.getDefaultChannelName() : this.getCustomChannelName(result) + } + async getLatestVersion(): Promise { const cancellationToken = new CancellationToken() @@ -136,7 +141,10 @@ export class GitHubProvider extends BaseGitHubProvider { } try { - const channel = this.updater.allowPrerelease ? this.getCustomChannelName(String(semver.prerelease(tag)?.[0] || "latest")) : this.getDefaultChannelName() + let channel = this.channel + if (this.updater.allowPrerelease && semver.prerelease(tag)?.[0]) { + channel = this.getCustomChannelName(String(semver.prerelease(tag)?.[0])) + } rawData = await fetchData(channel) } catch (e: any) { if (this.updater.allowPrerelease) {