Merge branch 'main' of https://github.com/actions/setup-dotnet into feature/include-prerelease
This commit is contained in:
commit
87189a16c7
|
@ -0,0 +1 @@
|
||||||
|
* @actions/virtual-environments-owners
|
|
@ -13,7 +13,7 @@ This action sets up a [dotnet core cli](https://github.com/dotnet/cli) environme
|
||||||
Please Note: GitHub hosted runners have some versions of the .NET SDK
|
Please Note: GitHub hosted runners have some versions of the .NET SDK
|
||||||
preinstalled. Installed versions are subject to change. Please refer to the
|
preinstalled. Installed versions are subject to change. Please refer to the
|
||||||
documentation
|
documentation
|
||||||
[software installed on github hosted runners](https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners)
|
[software installed on github hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software)
|
||||||
for .NET SDK versions that are currently available.
|
for .NET SDK versions that are currently available.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
@ -37,7 +37,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
dotnet: [ '2.2.103', '3.0', '3.1.x' ]
|
dotnet: [ '2.1.x', '3.1.x', '5.0.x' ]
|
||||||
name: Dotnet ${{ matrix.dotnet }} sample
|
name: Dotnet ${{ matrix.dotnet }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -59,7 +59,7 @@ jobs:
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: '2.2.103'
|
dotnet-version: '2.1.x'
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
|
@ -113,7 +113,7 @@ build:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.100' # SDK Version to use.
|
dotnet-version: '3.1.x' # SDK Version to use.
|
||||||
```
|
```
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
|
@ -13,6 +13,8 @@ describe('version tests', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
each([
|
each([
|
||||||
|
['3.x', '3.x'],
|
||||||
|
['3.*', '3.*'],
|
||||||
['3.1.x', '3.1'],
|
['3.1.x', '3.1'],
|
||||||
['1.1.*', '1.1'],
|
['1.1.*', '1.1'],
|
||||||
['2.0', '2.0']
|
['2.0', '2.0']
|
||||||
|
@ -42,7 +44,6 @@ describe('version tests', () => {
|
||||||
'.2.3',
|
'.2.3',
|
||||||
'.2.x',
|
'.2.x',
|
||||||
'1',
|
'1',
|
||||||
'2.x',
|
|
||||||
'*.*.1',
|
'*.*.1',
|
||||||
'*.1',
|
'*.1',
|
||||||
'*.',
|
'*.',
|
||||||
|
|
|
@ -4840,11 +4840,23 @@ const github = __importStar(__webpack_require__(469));
|
||||||
const xmlbuilder = __importStar(__webpack_require__(312));
|
const xmlbuilder = __importStar(__webpack_require__(312));
|
||||||
const xmlParser = __importStar(__webpack_require__(989));
|
const xmlParser = __importStar(__webpack_require__(989));
|
||||||
function configAuthentication(feedUrl, existingFileLocation = '', processRoot = process.cwd()) {
|
function configAuthentication(feedUrl, existingFileLocation = '', processRoot = process.cwd()) {
|
||||||
const existingNuGetConfig = path.resolve(processRoot, existingFileLocation == '' ? 'nuget.config' : existingFileLocation);
|
const existingNuGetConfig = path.resolve(processRoot, existingFileLocation === ''
|
||||||
|
? getExistingNugetConfig(processRoot)
|
||||||
|
: existingFileLocation);
|
||||||
const tempNuGetConfig = path.resolve(processRoot, '../', 'nuget.config');
|
const tempNuGetConfig = path.resolve(processRoot, '../', 'nuget.config');
|
||||||
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
|
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
|
||||||
}
|
}
|
||||||
exports.configAuthentication = configAuthentication;
|
exports.configAuthentication = configAuthentication;
|
||||||
|
function getExistingNugetConfig(processRoot) {
|
||||||
|
const defaultConfigName = 'nuget.config';
|
||||||
|
const configFileNames = fs
|
||||||
|
.readdirSync(processRoot)
|
||||||
|
.filter(filename => filename.toLowerCase() === defaultConfigName);
|
||||||
|
if (configFileNames.length) {
|
||||||
|
return configFileNames[0];
|
||||||
|
}
|
||||||
|
return defaultConfigName;
|
||||||
|
}
|
||||||
function writeFeedToFile(feedUrl, existingFileLocation, tempFileLocation) {
|
function writeFeedToFile(feedUrl, existingFileLocation, tempFileLocation) {
|
||||||
console.log(`dotnet-auth: Finding any source references in ${existingFileLocation}, writing a new temporary configuration file with credentials to ${tempFileLocation}`);
|
console.log(`dotnet-auth: Finding any source references in ${existingFileLocation}, writing a new temporary configuration file with credentials to ${tempFileLocation}`);
|
||||||
let xml;
|
let xml;
|
||||||
|
@ -16870,14 +16882,17 @@ class DotNetVersionInfo {
|
||||||
this.isExactVersionSet = true;
|
this.isExactVersionSet = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let parts = version.split('.');
|
//Note: No support for previews when using generic
|
||||||
|
const parts = version.split('.');
|
||||||
if (parts.length < 2 || parts.length > 3)
|
if (parts.length < 2 || parts.length > 3)
|
||||||
this.throwInvalidVersionFormat();
|
this.throwInvalidVersionFormat();
|
||||||
if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') {
|
if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') {
|
||||||
this.throwInvalidVersionFormat();
|
this.throwInvalidVersionFormat();
|
||||||
}
|
}
|
||||||
let major = this.getVersionNumberOrThrow(parts[0]);
|
const major = this.getVersionNumberOrThrow(parts[0]);
|
||||||
let minor = this.getVersionNumberOrThrow(parts[1]);
|
const minor = ['x', '*'].includes(parts[1])
|
||||||
|
? parts[1]
|
||||||
|
: this.getVersionNumberOrThrow(parts[1]);
|
||||||
this.fullversion = major + '.' + minor;
|
this.fullversion = major + '.' + minor;
|
||||||
}
|
}
|
||||||
getVersionNumberOrThrow(input) {
|
getVersionNumberOrThrow(input) {
|
||||||
|
@ -16895,7 +16910,7 @@ class DotNetVersionInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throwInvalidVersionFormat() {
|
throwInvalidVersionFormat() {
|
||||||
throw 'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*';
|
throw new Error('Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* If true exacatly one version should be resolved
|
* If true exacatly one version should be resolved
|
||||||
|
@ -16999,7 +17014,7 @@ class DotnetCoreInstaller {
|
||||||
}
|
}
|
||||||
console.log(process.env['PATH']);
|
console.log(process.env['PATH']);
|
||||||
if (resultCode != 0) {
|
if (resultCode != 0) {
|
||||||
throw `Failed to install dotnet ${resultCode}. ${output}`;
|
throw new Error(`Failed to install dotnet ${resultCode}. ${output}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -17035,7 +17050,7 @@ class DotnetCoreInstaller {
|
||||||
includePrerelease: this.includePrerelease
|
includePrerelease: this.includePrerelease
|
||||||
}));
|
}));
|
||||||
if (releasesInfo.length == 0) {
|
if (releasesInfo.length == 0) {
|
||||||
throw `Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`;
|
throw new Error(`Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`);
|
||||||
}
|
}
|
||||||
let release = releasesInfo[0];
|
let release = releasesInfo[0];
|
||||||
return release['sdk']['version'];
|
return release['sdk']['version'];
|
||||||
|
@ -17056,7 +17071,7 @@ class DotnetCoreInstaller {
|
||||||
return versionParts[0] == sdkParts[0];
|
return versionParts[0] == sdkParts[0];
|
||||||
});
|
});
|
||||||
if (releasesInfo.length === 0) {
|
if (releasesInfo.length === 0) {
|
||||||
throw `Could not find info for version ${versionParts.join('.')} at ${DotNetCoreIndexUrl}`;
|
throw new Error(`Could not find info for version ${versionParts.join('.')} at ${DotNetCoreIndexUrl}`);
|
||||||
}
|
}
|
||||||
return releasesInfo[0]['releases.json'];
|
return releasesInfo[0]['releases.json'];
|
||||||
});
|
});
|
||||||
|
|
|
@ -5342,9 +5342,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"y18n": {
|
"y18n": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
|
||||||
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
|
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yaml": {
|
"yaml": {
|
||||||
|
|
|
@ -13,7 +13,9 @@ export function configAuthentication(
|
||||||
) {
|
) {
|
||||||
const existingNuGetConfig: string = path.resolve(
|
const existingNuGetConfig: string = path.resolve(
|
||||||
processRoot,
|
processRoot,
|
||||||
existingFileLocation == '' ? 'nuget.config' : existingFileLocation
|
existingFileLocation === ''
|
||||||
|
? getExistingNugetConfig(processRoot)
|
||||||
|
: existingFileLocation
|
||||||
);
|
);
|
||||||
|
|
||||||
const tempNuGetConfig: string = path.resolve(
|
const tempNuGetConfig: string = path.resolve(
|
||||||
|
@ -25,6 +27,17 @@ export function configAuthentication(
|
||||||
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
|
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getExistingNugetConfig(processRoot: string) {
|
||||||
|
const defaultConfigName = 'nuget.config';
|
||||||
|
const configFileNames = fs
|
||||||
|
.readdirSync(processRoot)
|
||||||
|
.filter(filename => filename.toLowerCase() === defaultConfigName);
|
||||||
|
if (configFileNames.length) {
|
||||||
|
return configFileNames[0];
|
||||||
|
}
|
||||||
|
return defaultConfigName;
|
||||||
|
}
|
||||||
|
|
||||||
function writeFeedToFile(
|
function writeFeedToFile(
|
||||||
feedUrl: string,
|
feedUrl: string,
|
||||||
existingFileLocation: string,
|
existingFileLocation: string,
|
||||||
|
|
|
@ -29,7 +29,7 @@ export class DotNetVersionInfo {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let parts: string[] = version.split('.');
|
const parts: string[] = version.split('.');
|
||||||
|
|
||||||
if (parts.length < 2 || parts.length > 3) this.throwInvalidVersionFormat();
|
if (parts.length < 2 || parts.length > 3) this.throwInvalidVersionFormat();
|
||||||
|
|
||||||
|
@ -37,8 +37,10 @@ export class DotNetVersionInfo {
|
||||||
this.throwInvalidVersionFormat();
|
this.throwInvalidVersionFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
let major = this.getVersionNumberOrThrow(parts[0]);
|
const major = this.getVersionNumberOrThrow(parts[0]);
|
||||||
let minor = this.getVersionNumberOrThrow(parts[1]);
|
const minor = ['x', '*'].includes(parts[1])
|
||||||
|
? parts[1]
|
||||||
|
: this.getVersionNumberOrThrow(parts[1]);
|
||||||
|
|
||||||
this.fullversion = major + '.' + minor;
|
this.fullversion = major + '.' + minor;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +61,9 @@ export class DotNetVersionInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
private throwInvalidVersionFormat() {
|
private throwInvalidVersionFormat() {
|
||||||
throw 'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*';
|
throw new Error(
|
||||||
|
'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,7 +191,7 @@ export class DotnetCoreInstaller {
|
||||||
console.log(process.env['PATH']);
|
console.log(process.env['PATH']);
|
||||||
|
|
||||||
if (resultCode != 0) {
|
if (resultCode != 0) {
|
||||||
throw `Failed to install dotnet ${resultCode}. ${output}`;
|
throw new Error(`Failed to install dotnet ${resultCode}. ${output}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +246,9 @@ export class DotnetCoreInstaller {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (releasesInfo.length == 0) {
|
if (releasesInfo.length == 0) {
|
||||||
throw `Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`;
|
throw new Error(
|
||||||
|
`Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let release = releasesInfo[0];
|
let release = releasesInfo[0];
|
||||||
|
@ -270,9 +276,11 @@ export class DotnetCoreInstaller {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (releasesInfo.length === 0) {
|
if (releasesInfo.length === 0) {
|
||||||
throw `Could not find info for version ${versionParts.join(
|
throw new Error(
|
||||||
|
`Could not find info for version ${versionParts.join(
|
||||||
'.'
|
'.'
|
||||||
)} at ${DotNetCoreIndexUrl}`;
|
)} at ${DotNetCoreIndexUrl}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return releasesInfo[0]['releases.json'];
|
return releasesInfo[0]['releases.json'];
|
||||||
|
|
Loading…
Reference in New Issue