Change logic of outputting when global.json is used

This commit is contained in:
IvanZosimov 2022-09-28 13:44:37 +02:00
parent 12c47bed3c
commit 75d47e04fb
2 changed files with 21 additions and 7 deletions

9
dist/index.js vendored
View File

@ -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')}`);
}

View File

@ -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) {