Compare commits

...

8 Commits

Author SHA1 Message Date
Dilum Aluthge
60da8f71d6 README: Fix another typo in the docs for min-minor 2026-03-07 14:24:05 -05:00
Dilum Aluthge
39ecde6b2e README: Fix some typos in the docs for min/min-minor/min-patch 2026-03-07 14:23:33 -05:00
Dilum Aluthge
6cff0eae75 Update README to reflect min/min-minor/min-patch 2026-03-07 14:22:30 -05:00
Dilum Aluthge
9053e48e3c Add min-minor and min-patch 2026-03-07 14:18:02 -05:00
Dilum Aluthge
3241879f97 Fix 2026-03-05 15:01:52 -05:00
Dilum Aluthge
2c2e035e86 Update README.md 2026-03-04 22:14:00 -05:00
Dilum Aluthge
210e196714 Update installer.ts 2026-03-04 22:11:51 -05:00
Dilum Aluthge
c8ff8a1937 Breaking: Change min to return the latest patch
The major/minor will be the minimum, but the patch will be the latest. E.g. `julia = "1.10"` would lead to e.g. 1.10.10 (not 1.10.0).
2026-03-04 22:06:45 -05:00
2 changed files with 20 additions and 4 deletions

View File

@@ -139,7 +139,9 @@ You can either specify specific Julia versions or version ranges. If you specify
- `'pre'` will install the latest prerelease build (RCs, betas, and alphas). - `'pre'` will install the latest prerelease build (RCs, betas, and alphas).
- `'nightly'` will install the latest nightly build. - `'nightly'` will install the latest nightly build.
- `'1.7-nightly'` will install the latest nightly build for the upcoming 1.7 release. This version will only be available during certain phases of the Julia release cycle. - `'1.7-nightly'` will install the latest nightly build for the upcoming 1.7 release. This version will only be available during certain phases of the Julia release cycle.
- `'min'` will install the earliest supported version of Julia compatible with the project. Especially useful in monorepos. - `'min'` is equivalent to `min-minor`.
- `'min-minor'` will install the earliest supported major/minor version of Julia compatible with the project. Especially useful in monorepos. Note: `min-minor` chooses the lowest major/minor, but gives the latest patch. For example, for a Julia `[compat]` entry of `julia = "1.10"`, `min-minor` would resolve to e.g. `1.10.11` (NOT `1.10.0`).
- `'min-patch'` will install the earliest supported major/minor/patch version of Julia compatible with the project. For example, for a Julia `[compat]` entry of `julia = "1.10"`, `min-patch` would resolve to e.g. `1.10.0`.
Internally the action uses node's semver package to resolve version ranges. Its [documentation](https://github.com/npm/node-semver#advanced-range-syntax) contains more details on the version range syntax. You can test what version will be selected for a given input in this JavaScript [REPL](https://repl.it/@SaschaMann/setup-julia-version-logic). Internally the action uses node's semver package to resolve version ranges. Its [documentation](https://github.com/npm/node-semver#advanced-range-syntax) contains more details on the version range syntax. You can test what version will be selected for a given input in this JavaScript [REPL](https://repl.it/@SaschaMann/setup-julia-version-logic).

View File

@@ -174,12 +174,26 @@ export function getJuliaVersion(availableReleases: string[], versionInput: strin
if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) { if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) {
// versionInput is a valid version or a nightly version, use it directly // versionInput is a valid version or a nightly version, use it directly
version = versionInput 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 // Resolve "min" to the minimum supported Julia version compatible with the project file
if (!juliaCompatRange) { 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.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})
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}`)
} }
version = semver.minSatisfying(availableReleases, juliaCompatRange, {includePrerelease})
} else if (versionInput == "lts") { } else if (versionInput == "lts") {
version = semver.maxSatisfying(availableReleases, LTS_VERSION, { includePrerelease: false }); version = semver.maxSatisfying(availableReleases, LTS_VERSION, { includePrerelease: false });
} else if (versionInput == "pre") { } else if (versionInput == "pre") {