Skip to content

Commit 8009973

Browse files
authored
feat: support Arm (#593)
I think we need to set up an Arm runner group to test all options which is not recommended for public repositories
1 parent 89c8706 commit 8009973

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

dist/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18241,8 +18241,10 @@ pWaitFor.resolveWith = value => ({[resolveValue]: value});
1824118241

1824218242

1824318243
const binaries = {
18244-
darwin: 'cloudquery_darwin_amd64',
18245-
linux: 'cloudquery_linux_amd64',
18244+
darwin_arm64: 'cloudquery_darwin_arm64',
18245+
darwin_x64: 'cloudquery_darwin_amd64',
18246+
linux_arm64: 'cloudquery_linux_arm64',
18247+
linux_x64: 'cloudquery_linux_amd64',
1824618248
};
1824718249
const resolveDownloadUrl = async (version, binary) => {
1824818250
const tag = version.startsWith('v') ? `cli-${version}` : `cli-v${version}`;
@@ -18267,9 +18269,10 @@ const assetExists = async (url) => {
1826718269
}
1826818270
};
1826918271
const installBinary = async (version) => {
18270-
const binary = binaries[(0,external_os_.platform)()];
18272+
const binaryKey = ((0,external_os_.platform)() + '_' + (0,external_os_.arch)());
18273+
const binary = binaries[binaryKey];
1827118274
if (!binary) {
18272-
throw new Error(`Unsupported platform: ${(0,external_os_.platform)()}`);
18275+
throw new Error(`Unsupported platform: ${binaryKey}`);
1827318276
}
1827418277
const message = `version '${source.green(version)}'`;
1827518278
const spinner = ora(`Downloading ${message} of CloudQuery`).start();

src/main.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import * as core from '@actions/core';
22
import fetch from 'node-fetch';
33
import chalk from 'chalk';
4-
import { platform } from 'os';
4+
import { platform, arch } from 'os';
55
import { execaCommand } from 'execa';
66
import ora from 'ora';
77
import semver from 'semver';
88
import path from 'path';
99
import pWaitFor from 'p-wait-for';
1010

1111
const binaries = {
12-
darwin: 'cloudquery_darwin_amd64',
13-
linux: 'cloudquery_linux_amd64',
12+
darwin_arm64: 'cloudquery_darwin_arm64',
13+
darwin_x64: 'cloudquery_darwin_amd64',
14+
linux_arm64: 'cloudquery_linux_arm64',
15+
linux_x64: 'cloudquery_linux_amd64',
1416
};
1517

1618
const resolveDownloadUrl = async (version: string, binary: string) => {
@@ -37,9 +39,10 @@ const assetExists = async (url: string) => {
3739
};
3840

3941
export const installBinary = async (version: string) => {
40-
const binary = binaries[platform() as keyof typeof binaries];
42+
const binaryKey = (platform() + '_' + arch()) as keyof typeof binaries;
43+
const binary = binaries[binaryKey];
4144
if (!binary) {
42-
throw new Error(`Unsupported platform: ${platform()}`);
45+
throw new Error(`Unsupported platform: ${binaryKey}`);
4346
}
4447
const message = `version '${chalk.green(version)}'`;
4548
const spinner = ora(`Downloading ${message} of CloudQuery`).start();

0 commit comments

Comments
 (0)