11import * as core from '@actions/core' ;
22import fetch from 'node-fetch' ;
33import chalk from 'chalk' ;
4- import { platform } from 'os' ;
4+ import { platform , arch } from 'os' ;
55import { execaCommand } from 'execa' ;
66import ora from 'ora' ;
77import semver from 'semver' ;
88import path from 'path' ;
99import pWaitFor from 'p-wait-for' ;
1010
1111const 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
1618const resolveDownloadUrl = async ( version : string , binary : string ) => {
@@ -37,9 +39,10 @@ const assetExists = async (url: string) => {
3739} ;
3840
3941export 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