Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reference runner arch, not just amd64 always #57

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13565,8 +13565,23 @@ function osPlatform() {
case "linux":
case "darwin":
return platform;
case "win32":
return "windows";
default:
throw new Error("Unsupported operating system - the Patcher action is only released for Darwin and Linux");
throw new Error("Unsupported operating system - the Patcher action is only released for Darwin, Linux, and Windows32.");
}
}
function arch() {
const arch = os.arch();
switch (arch) {
case "arm64":
return arch;
case "x64":
return "amd64";
case "ia32":
return "386";
default:
throw new Error("Unsupported architecture - the Patcher action is only released for arm64, amd64, and i386.");
}
}
function repoToBinaryMap(repo) {
Expand Down Expand Up @@ -13598,7 +13613,7 @@ async function downloadGitHubBinary(octokit, owner, repo, tag, token) {
repo,
tag,
});
const re = new RegExp(`${osPlatform()}.*amd64`);
const re = new RegExp(`${osPlatform()}.*${arch()}`);
const asset = getReleaseResponse.data.assets.find((obj) => re.test(obj.name));
if (!asset) {
throw new Error(`Can not find ${owner}/${repo} release for ${tag} in platform ${re}.`);
Expand Down
22 changes: 20 additions & 2 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,26 @@ function osPlatform() {
case "linux":
case "darwin":
return platform;
case "win32":
return "windows";
default:
throw new Error("Unsupported operating system - the Patcher action is only released for Darwin and Linux");
throw new Error(
"Unsupported operating system - the Patcher action is only released for Darwin, Linux, and Windows32."
);
}
}

function arch() {
const arch = os.arch();
switch (arch) {
case "arm64":
return arch;
case "x64":
return "amd64";
case "ia32":
return "386";
default:
throw new Error("Unsupported architecture - the Patcher action is only released for arm64, amd64, and i386.");
}
}

Expand Down Expand Up @@ -123,7 +141,7 @@ async function downloadGitHubBinary(
tag,
});

const re = new RegExp(`${osPlatform()}.*amd64`);
const re = new RegExp(`${osPlatform()}.*${arch()}`);
const asset = getReleaseResponse.data.assets.find((obj: any) => re.test(obj.name));

if (!asset) {
Expand Down
Loading