Skip to content

Commit 6895833

Browse files
committed
Fix architecture.
1 parent 1d88810 commit 6895833

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

index.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const os = require('os');
66
const name = 'aliyun';
77
const platform = os.platform();
88
const version = core.getInput('aliyun-cli-version', { required: true });
9+
const arch = getArch(os.arch());
910

1011
const configs = [
1112
{ input: 'mode', flag: '--mode' },
@@ -21,6 +22,26 @@ for (const config of configs) {
2122
config.value = core.getInput(config.input);
2223
}
2324

25+
function getArch(arch) {
26+
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
27+
28+
// wants amd64, 386, arm64, armv61, ppc641e, s390x
29+
// currently not supported by runner but future proofed mapping
30+
switch (arch) {
31+
case 'x64':
32+
arch = 'amd64';
33+
break;
34+
case 'x32':
35+
arch = '386';
36+
break;
37+
case 'arm':
38+
arch = 'armv6l';
39+
break;
40+
}
41+
42+
return arch;
43+
}
44+
2445
async function run() {
2546
const [system, ext, extractFunc, executable] = (function() { switch(platform) {
2647
case 'linux':
@@ -33,7 +54,7 @@ async function run() {
3354
throw new Error(`Unexpected OS ${platform}`);
3455
}})();
3556

36-
const url = `https://github.com/aliyun/aliyun-cli/releases/download/v${version}/aliyun-cli-${system}-${version}-amd64.${ext}`;
57+
const url = `https://github.com/aliyun/aliyun-cli/releases/download/v${version}/aliyun-cli-${system}-${version}-${arch}.${ext}`;
3758
const downloadedPath = await tc.downloadTool(url);
3859
const extractedPath = await tc[extractFunc](downloadedPath);
3960
const cachedPath = await tc.cacheDir(extractedPath, name, version);

0 commit comments

Comments
 (0)