Skip to content

Commit

Permalink
Add support for all Task build architectures
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
per1234 and Bikappa committed Jan 31, 2023
1 parent fe65533 commit 43e1bb8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 43e1bb8

Please sign in to comment.