Skip to content

Commit 43e1bb8

Browse files
per1234Bikappa
andcommitted
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 <[email protected]>
1 parent fe65533 commit 43e1bb8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

dist/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,15 @@ function computeVersion(version, repoToken) {
146146
});
147147
}
148148
function getFileName() {
149+
var _a;
149150
const platform = osPlat === "win32" ? "windows" : osPlat;
150-
const arch = osArch === "x64" ? "amd64" : "386";
151+
const arches = {
152+
arm: "arm",
153+
arm64: "arm64",
154+
x64: "amd64",
155+
ia32: "386",
156+
};
157+
const arch = (_a = arches[osArch]) !== null && _a !== void 0 ? _a : osArch;
151158
const ext = osPlat === "win32" ? "zip" : "tar.gz";
152159
const filename = util.format("task_%s_%s.%s", platform, arch, ext);
153160
return filename;

src/installer.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,13 @@ async function computeVersion(
136136

137137
function getFileName() {
138138
const platform: string = osPlat === "win32" ? "windows" : osPlat;
139-
const arch: string = osArch === "x64" ? "amd64" : "386";
139+
const arches = {
140+
arm: "arm",
141+
arm64: "arm64",
142+
x64: "amd64",
143+
ia32: "386",
144+
};
145+
const arch: string = arches[osArch] ?? osArch;
140146
const ext: string = osPlat === "win32" ? "zip" : "tar.gz";
141147
const filename: string = util.format("task_%s_%s.%s", platform, arch, ext);
142148

0 commit comments

Comments
 (0)