Skip to content

Commit

Permalink
Merge pull request #57 from gruntwork-io/ceschae/sme-2135-patcher-iss…
Browse files Browse the repository at this point in the history
…ues-on-arm64-github-runner-hubspot-id-16414969005

reference runner arch, not just amd64 always
  • Loading branch information
ceschae authored Jan 10, 2025
2 parents 4d93d93 + 7e0e232 commit d1af406
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
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

0 comments on commit d1af406

Please sign in to comment.