From 9053e48e3ce0dc69f80f9c151b00c24c138f5fbd Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Sat, 7 Mar 2026 14:18:02 -0500 Subject: [PATCH] Add `min-minor` and `min-patch` --- src/installer.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index b4f7e15..29d829c 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -174,20 +174,26 @@ export function getJuliaVersion(availableReleases: string[], versionInput: strin if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) { // versionInput is a valid version or a nightly version, use it directly version = versionInput - } else if (versionInput == "min") { + } else if (versionInput == "min" || versionInput == "min-minor" || versionInput == "min-patch") { // Resolve "min" to the minimum supported Julia version compatible with the project file if (!juliaCompatRange) { - throw new Error('Unable to use version "min" when the Julia project file does not specify a compat for Julia') + throw new Error('Unable to use version "min" (or "min-minor" or "min-patch") when the Julia project file does not specify a compat for Julia') } // true_min_version is the actual minimum // E.g. if the Julia [compat] entry is "1.10", then true_min_version is v"1.10.0" let true_min_version = semver.minSatisfying(availableReleases, juliaCompatRange, {includePrerelease}) let my_tilde_range = `~${true_min_version}` // min_with_latest_patch is the minimum major/minor, but latest patch - // E.g. if the Julia [compat] entry is "1.10", then true__version is v"1.10.10" (or whatever the latest 1.10.x patch is) + // E.g. if the Julia [compat] entry is "1.10", then true__version is v"1.10.11" (or whatever the latest 1.10.x patch is) // https://github.com/julia-actions/setup-julia/issues/372 let min_with_latest_patch = semver.maxSatisfying(availableReleases, my_tilde_range, {includePrerelease}) - version = min_with_latest_patch + if (versionInput == "min" || versionInput == "min-minor") { + version = min_with_latest_patch + } else if (versionInput == "min-patch") { + version = true_min_version + } else { + throw new Error(`Unexpected error. Invalid value for versionInput: ${versionInput}`) + } } else if (versionInput == "lts") { version = semver.maxSatisfying(availableReleases, LTS_VERSION, { includePrerelease: false }); } else if (versionInput == "pre") {