diff --git a/dist/index.js b/dist/index.js index a167ab0..bf3e1cd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -483,9 +483,14 @@ function run() { if (sourceUrl) { auth.configAuthentication(sourceUrl, configFile); } - core.setOutput('dotnet-version', semver_1.default.maxSatisfying(installedDotnetVersions, '*', { + const comparisonRange = globalJsonFileInput + ? versions.at(-1) + : '*'; + const includePrereleaseOption = { includePrerelease: true - })); + }; + const versionToOutput = semver_1.default.maxSatisfying(installedDotnetVersions, comparisonRange, includePrereleaseOption); + core.setOutput('dotnet-version', versionToOutput); const matchersPath = path_1.default.join(__dirname, '..', '.github'); core.info(`##[add-matcher]${path_1.default.join(matchersPath, 'csc.json')}`); } diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 6246b3b..5cdb880 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -74,13 +74,22 @@ export async function run() { auth.configAuthentication(sourceUrl, configFile); } - core.setOutput( - 'dotnet-version', - semver.maxSatisfying(installedDotnetVersions, '*', { - includePrerelease: true - }) + const comparisonRange: string = globalJsonFileInput + ? versions.at(-1)! + : '*'; + + const includePrereleaseOption = { + includePrerelease: true + }; + + const versionToOutput = semver.maxSatisfying( + installedDotnetVersions, + comparisonRange, + includePrereleaseOption ); + core.setOutput('dotnet-version', versionToOutput); + const matchersPath = path.join(__dirname, '..', '.github'); core.info(`##[add-matcher]${path.join(matchersPath, 'csc.json')}`); } catch (error) {