Skip to content

Commit daec915

Browse files
authored
Fix aarch binaries download url (#399)
* 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
1 parent 0483b79 commit daec915

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/main.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@ import * as os from 'os'
44
import * as path from 'path'
55
import * as tc from '@actions/tool-cache'
66

7-
const csVersion = core.getInput('version') || '2.1.2'
7+
const defaultVersion_x86_64 = '2.1.2'
8+
const defaultVersion_aarch64 = '2.1.1'
89

10+
const architecture_x86_64 = 'x86_64'
11+
const architecture_aarch64 = 'aarch64'
12+
13+
const architecture = getCoursierArchitecture()
14+
const csVersion = core.getInput('version') || (architecture === architecture_x86_64
15+
? defaultVersion_x86_64
16+
: defaultVersion_aarch64
17+
)
918
const coursierVersionSpec = csVersion
19+
const coursierBinariesGithubRepository = (architecture === architecture_x86_64)
20+
? 'https://github.com/coursier/coursier/'
21+
: 'https://github.com/VirtusLab/coursier-m1/'
1022

1123
function getCoursierArchitecture(): string {
1224
if (process.arch === 'x64') {
13-
return 'x86_64'
25+
return architecture_x86_64
1426
} else if (process.arch === 'arm' || process.arch === 'arm64') {
15-
return 'aarch64'
27+
return architecture_aarch64
1628
} else {
1729
throw new Error(`Coursier does not have support for the ${process.arch} architecture`)
1830
}
@@ -32,8 +44,7 @@ async function execOutput(cmd: string, ...args: string[]): Promise<string> {
3244
}
3345

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

0 commit comments

Comments
 (0)