Skip to content

Commit 68cb47d

Browse files
authored
fix: fix stable channel version on Intel Mac (browser-actions#351)
1 parent ee405af commit 68cb47d

File tree

1 file changed

+6
-33
lines changed

1 file changed

+6
-33
lines changed

src/channel_macos.ts

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Platform, Arch } from "./platform";
1+
import { Platform } from "./platform";
22
import { Installer, DownloadResult, InstallResult } from "./installer";
3-
import { ChannelName, isChannelName } from "./channel";
3+
import { isChannelName } from "./channel";
44
import * as tc from "@actions/tool-cache";
55
import * as exec from "@actions/exec";
66
import * as core from "@actions/core";
@@ -20,48 +20,21 @@ export class MacOSChannelInstaller implements Installer {
2020
}
2121
}
2222

23-
download(version: string): Promise<DownloadResult> {
23+
async download(version: string): Promise<DownloadResult> {
2424
if (!isChannelName(version)) {
2525
throw new Error(`Unexpected version: ${version}`);
2626
}
27-
switch (this.platform.arch) {
28-
case Arch.AMD64:
29-
return this.downloadForIntelChip(version);
30-
case Arch.ARM64:
31-
return this.downloadForAppleChip(version);
32-
default:
33-
throw new Error(
34-
`Chromium ${version} not supported for platform ${this.platform.os} ${this.platform.arch}`
35-
);
36-
}
37-
}
3827

39-
async downloadForIntelChip(channel: ChannelName): Promise<DownloadResult> {
4028
const url = (() => {
41-
switch (channel) {
42-
case "stable":
43-
return `https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg`;
44-
default:
45-
return `https://dl.google.com/chrome/mac/${channel}/googlechrome${channel}.dmg`;
46-
}
47-
})();
48-
49-
core.info(`Acquiring ${channel} from ${url}`);
50-
const archive = await tc.downloadTool(url);
51-
return { archive };
52-
}
53-
54-
async downloadForAppleChip(channel: ChannelName): Promise<DownloadResult> {
55-
const url = (() => {
56-
switch (channel) {
29+
switch (version) {
5730
case "stable":
5831
return `https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg`;
5932
default:
60-
return `https://dl.google.com/chrome/mac/universal/${channel}/googlechrome${channel}.dmg`;
33+
return `https://dl.google.com/chrome/mac/universal/${version}/googlechrome${version}.dmg`;
6134
}
6235
})();
6336

64-
core.info(`Acquiring ${channel} from ${url}`);
37+
core.info(`Acquiring ${version} from ${url}`);
6538
const archive = await tc.downloadTool(url);
6639
return { archive };
6740
}

0 commit comments

Comments
 (0)