Skip to content

Commit

Permalink
Fix aarch binaries download url (#399)
Browse files Browse the repository at this point in the history
* Add config object

* Add default versions

* Revert adding config

* fixup! Revert adding config

* Update binaries download base url github repository

* Remove unused 'architecture' variable from 'downloadCoursier' function

* Fix equality operator
  • Loading branch information
xRuiAlves committed Apr 25, 2023
1 parent 0483b79 commit daec915
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,27 @@ import * as os from 'os'
import * as path from 'path'
import * as tc from '@actions/tool-cache'

const csVersion = core.getInput('version') || '2.1.2'
const defaultVersion_x86_64 = '2.1.2'
const defaultVersion_aarch64 = '2.1.1'

const architecture_x86_64 = 'x86_64'
const architecture_aarch64 = 'aarch64'

const architecture = getCoursierArchitecture()
const csVersion = core.getInput('version') || (architecture === architecture_x86_64
? defaultVersion_x86_64
: defaultVersion_aarch64
)
const coursierVersionSpec = csVersion
const coursierBinariesGithubRepository = (architecture === architecture_x86_64)
? 'https://github.com/coursier/coursier/'
: 'https://github.com/VirtusLab/coursier-m1/'

function getCoursierArchitecture(): string {
if (process.arch === 'x64') {
return 'x86_64'
return architecture_x86_64
} else if (process.arch === 'arm' || process.arch === 'arm64') {
return 'aarch64'
return architecture_aarch64
} else {
throw new Error(`Coursier does not have support for the ${process.arch} architecture`)
}
Expand All @@ -32,8 +44,7 @@ async function execOutput(cmd: string, ...args: string[]): Promise<string> {
}

async function downloadCoursier(): Promise<string> {
const architecture = getCoursierArchitecture()
const baseUrl = `https://github.com/coursier/coursier/releases/download/v${csVersion}/cs-${architecture}`
const baseUrl = `${coursierBinariesGithubRepository}/releases/download/v${csVersion}/cs-${architecture}`
let csBinary = ''
switch (process.platform) {
case 'linux': {
Expand Down

0 comments on commit daec915

Please sign in to comment.