From 43e1bb8c37ce39c24e88b4622c2f66b6d7d9ebbd Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 26 Jan 2023 06:18:36 -0800 Subject: [PATCH] Add support for all Task build architectures Previously, the action could only install Task when the runner had an x86-64 or i386 architecture. Since the GitHub-hosted runners are currently all x86-64, that is sufficient for most users. However, it is also possible to use GitHub actions with self-hosted runners of other architectures. Task builds are available for more architectures, so the action's code unnecessarily limited its utility. Support for all architectures with available builds is hereby added. In order to provide some possibility of automatic support for additional builds that may become available in the future, if the action code does not contain a mapped value for the host architecture, the value from Node.js is used verbatim. Because the mapping between the architecture value provided by Node.js to the filename suffix used in the Task build archives is a bit confusing, I added mapping entries for all suffixes, even in the cases where the two values are equal. Co-authored-by: Luca Bianconi <71259950+Bikappa@users.noreply.github.com> --- dist/index.js | 9 ++++++++- src/installer.ts | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 3100f0a3..887c39aa 100644 --- a/dist/index.js +++ b/dist/index.js @@ -146,8 +146,15 @@ function computeVersion(version, repoToken) { }); } function getFileName() { + var _a; const platform = osPlat === "win32" ? "windows" : osPlat; - const arch = osArch === "x64" ? "amd64" : "386"; + const arches = { + arm: "arm", + arm64: "arm64", + x64: "amd64", + ia32: "386", + }; + const arch = (_a = arches[osArch]) !== null && _a !== void 0 ? _a : osArch; const ext = osPlat === "win32" ? "zip" : "tar.gz"; const filename = util.format("task_%s_%s.%s", platform, arch, ext); return filename; diff --git a/src/installer.ts b/src/installer.ts index d4c1a989..34f846b9 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -136,7 +136,13 @@ async function computeVersion( function getFileName() { const platform: string = osPlat === "win32" ? "windows" : osPlat; - const arch: string = osArch === "x64" ? "amd64" : "386"; + const arches = { + arm: "arm", + arm64: "arm64", + x64: "amd64", + ia32: "386", + }; + const arch: string = arches[osArch] ?? osArch; const ext: string = osPlat === "win32" ? "zip" : "tar.gz"; const filename: string = util.format("task_%s_%s.%s", platform, arch, ext);