Skip to content

Commit 12c4a76

Browse files
authored
Bump coursier to 2.1.25-M19 (#976)
1 parent 6061f9b commit 12c4a76

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

src/main.ts

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,40 @@ const architecture_aarch64 = 'aarch64'
1111

1212
const architecture = getArchitecture()
1313

14-
const csDefaultVersion_x86_64 = '2.1.24'
15-
const csDefaultVersion_aarch64 = '2.1.24'
16-
17-
const csVersion =
18-
core.getInput('version') ||
19-
(architecture === architecture_x86_64 ? csDefaultVersion_x86_64 : csDefaultVersion_aarch64)
14+
const csDefaultVersion = '2.1.25-M19'
15+
const csVersion = core.getInput('version') || csDefaultVersion
2016

2117
const coursierVersionSpec = csVersion
2218

19+
function isVersionAtLeast(version: string, targetVersion: string): boolean {
20+
// Remove any milestone/RC suffix (e.g., "2.1.25-M19" -> "2.1.25")
21+
const baseVersion = version.split('-')[0]
22+
const baseTargetVersion = targetVersion.split('-')[0]
23+
24+
const parts = baseVersion.split('.').map(Number)
25+
const targetParts = baseTargetVersion.split('.').map(Number)
26+
27+
const major = parts[0] || 0
28+
const minor = parts[1] || 0
29+
const patch = parts[2] || 0
30+
31+
const targetMajor = targetParts[0] || 0
32+
const targetMinor = targetParts[1] || 0
33+
const targetPatch = targetParts[2] || 0
34+
35+
if (major > targetMajor) return true
36+
if (major < targetMajor) return false
37+
if (minor > targetMinor) return true
38+
if (minor < targetMinor) return false
39+
return patch >= targetPatch
40+
}
41+
2342
const coursierBinariesGithubRepository =
24-
architecture === architecture_x86_64
43+
isVersionAtLeast(csVersion, '2.1.25')
2544
? 'https://github.com/coursier/coursier/'
26-
: 'https://github.com/VirtusLab/coursier-m1/'
45+
: architecture === architecture_x86_64
46+
? 'https://github.com/coursier/coursier/'
47+
: 'https://github.com/VirtusLab/coursier-m1/'
2748

2849
function getArchitecture(): string {
2950
if (process.arch === 'x64') {

0 commit comments

Comments
 (0)