Skip to content

Commit

Permalink
feat: support Arm (#593)
Browse files Browse the repository at this point in the history
I think we need to set up an Arm runner group to test all options which is not recommended for public repositories
  • Loading branch information
erezrokah authored Oct 2, 2024
1 parent 89c8706 commit 8009973
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18241,8 +18241,10 @@ pWaitFor.resolveWith = value => ({[resolveValue]: value});


const binaries = {
darwin: 'cloudquery_darwin_amd64',
linux: 'cloudquery_linux_amd64',
darwin_arm64: 'cloudquery_darwin_arm64',
darwin_x64: 'cloudquery_darwin_amd64',
linux_arm64: 'cloudquery_linux_arm64',
linux_x64: 'cloudquery_linux_amd64',
};
const resolveDownloadUrl = async (version, binary) => {
const tag = version.startsWith('v') ? `cli-${version}` : `cli-v${version}`;
Expand All @@ -18267,9 +18269,10 @@ const assetExists = async (url) => {
}
};
const installBinary = async (version) => {
const binary = binaries[(0,external_os_.platform)()];
const binaryKey = ((0,external_os_.platform)() + '_' + (0,external_os_.arch)());
const binary = binaries[binaryKey];
if (!binary) {
throw new Error(`Unsupported platform: ${(0,external_os_.platform)()}`);
throw new Error(`Unsupported platform: ${binaryKey}`);
}
const message = `version '${source.green(version)}'`;
const spinner = ora(`Downloading ${message} of CloudQuery`).start();
Expand Down
13 changes: 8 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import * as core from '@actions/core';
import fetch from 'node-fetch';
import chalk from 'chalk';
import { platform } from 'os';
import { platform, arch } from 'os';
import { execaCommand } from 'execa';
import ora from 'ora';
import semver from 'semver';
import path from 'path';
import pWaitFor from 'p-wait-for';

const binaries = {
darwin: 'cloudquery_darwin_amd64',
linux: 'cloudquery_linux_amd64',
darwin_arm64: 'cloudquery_darwin_arm64',
darwin_x64: 'cloudquery_darwin_amd64',
linux_arm64: 'cloudquery_linux_arm64',
linux_x64: 'cloudquery_linux_amd64',
};

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

export const installBinary = async (version: string) => {
const binary = binaries[platform() as keyof typeof binaries];
const binaryKey = (platform() + '_' + arch()) as keyof typeof binaries;
const binary = binaries[binaryKey];
if (!binary) {
throw new Error(`Unsupported platform: ${platform()}`);
throw new Error(`Unsupported platform: ${binaryKey}`);
}
const message = `version '${chalk.green(version)}'`;
const spinner = ora(`Downloading ${message} of CloudQuery`).start();
Expand Down

0 comments on commit 8009973

Please sign in to comment.