Skip to content

Commit 28c4cd8

Browse files
authored
Fix and simplify LibJS installation
1 parent 09a20f3 commit 28c4cd8

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/engines/libjs.js

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ function getFilename() {
1111
switch (platform) {
1212
case 'linux-x64':
1313
return 'Linux-x86_64';
14-
case 'darwin-x64':
15-
return 'macOS-universal2';
1614
case 'darwin-arm64':
17-
return 'macOS-universal2';
15+
return 'macOS-arm64';
1816
default:
1917
throw new Error(`LibJS does not have binary builds for ${platform}`);
2018
}
@@ -35,25 +33,20 @@ class LibJSInstaller extends Installer {
3533

3634
const artifactId = await fetch('https://api.github.com/repos/ladybirdbrowser/ladybird/actions/artifacts')
3735
.then((x) => x.json())
38-
.then((x) => x.artifacts.filter((a) => a.name === artifactName))
39-
.then((x) => x[0].id)
36+
.then((x) => x.artifacts.find((a) => a.name === artifactName))
37+
.then((x) => x.id)
4038
.catch(() => {
4139
throw new Error(`Failed to find any releases for ${artifactName} on LadybirdBrowser/ladybird`);
4240
});
43-
const runId = await fetch('https://api.github.com/repos/ladybirdbrowser/ladybird/actions/runs?event=push&branch=master&status=success')
44-
.then((x) => x.json())
45-
.then((x) => x.workflow_runs.filter((a) => a.name === 'Package the js repl as a binary artifact'))
46-
.then((x) => x.sort((a, b) => a.check_suite_id > b.check_suite_id))
47-
.then((x) => x[0].check_suite_id)
48-
.catch(() => {
49-
throw new Error('Failed to find any recent ladybird-js build');
50-
});
51-
return `${runId}/${artifactId}`;
41+
return `gh-actions-artifact-${artifactId}`;
5242
}
5343

5444
getDownloadURL(version) {
55-
const ids = version.split('/');
56-
return `https://nightly.link/ladybirdbrowser/ladybird/suites/${ids[0]}/artifacts/${ids[1]}`;
45+
if (version.startsWith('gh-actions-artifact-')) {
46+
const artifactId = version.slice('gh-actions-artifact-'.length);
47+
return `https://nightly.link/ladybirdbrowser/ladybird/actions/artifacts/${artifactId}.zip`;
48+
}
49+
throw new Error(`Unexpected version format for ${version}`);
5750
}
5851

5952
async extract() {
@@ -62,7 +55,6 @@ class LibJSInstaller extends Installer {
6255
}
6356

6457
async install() {
65-
await this.registerAssets('lib/**');
6658
const js = await this.registerAsset('bin/js');
6759
this.binPath = await this.registerScript('ladybird-js', `"${js}"`);
6860
}

0 commit comments

Comments
 (0)