From 4f71fcfa8188d6a27457cb92dfead2109a4d8954 Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Thu, 4 Mar 2021 21:24:09 +0300 Subject: [PATCH 01/14] Add @actions/virtual-environments-owners to CODEOWNERS file --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..e230aaa --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @actions/virtual-environments-owners From 36fa9877a93876f714083cf7deec26bbe66d0dbc Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Wed, 17 Mar 2021 12:38:57 +0300 Subject: [PATCH 02/14] try fixing 5.x issue --- dist/index.js | 16 +++++++++++----- src/installer.ts | 25 ++++++++++++++++++------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/dist/index.js b/dist/index.js index 15f8a3b..aadf381 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16876,7 +16876,13 @@ class DotNetVersionInfo { this.throwInvalidVersionFormat(); } let major = this.getVersionNumberOrThrow(parts[0]); - let minor = this.getVersionNumberOrThrow(parts[1]); + let minor; + if (parts[1] === 'x') { + minor = parts[1]; + } + else { + minor = this.getVersionNumberOrThrow(parts[1]); + } this.fullversion = major + '.' + minor; } getVersionNumberOrThrow(input) { @@ -16894,7 +16900,7 @@ class DotNetVersionInfo { } } 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 @@ -16997,7 +17003,7 @@ class DotnetCoreInstaller { } console.log(process.env['PATH']); if (resultCode != 0) { - throw `Failed to install dotnet ${resultCode}. ${output}`; + throw new Error(`Failed to install dotnet ${resultCode}. ${output}`); } }); } @@ -17025,7 +17031,7 @@ class DotnetCoreInstaller { // Sort for latest version releasesInfo = releasesInfo.sort((a, b) => semver.rcompare(a['sdk']['version'], b['sdk']['version'])); 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]; return release['sdk']['version']; @@ -17046,7 +17052,7 @@ class DotnetCoreInstaller { return versionParts[0] == sdkParts[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']; }); diff --git a/src/installer.ts b/src/installer.ts index f0b48a2..12113e6 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -39,7 +39,12 @@ export class DotNetVersionInfo { } let major = this.getVersionNumberOrThrow(parts[0]); - let minor = this.getVersionNumberOrThrow(parts[1]); + let minor; + if (parts[1] === 'x') { + minor = parts[1]; + } else { + minor = this.getVersionNumberOrThrow(parts[1]); + } this.fullversion = major + '.' + minor; } @@ -60,7 +65,9 @@ export class DotNetVersionInfo { } 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 +194,7 @@ export class DotnetCoreInstaller { console.log(process.env['PATH']); if (resultCode != 0) { - throw `Failed to install dotnet ${resultCode}. ${output}`; + throw new Error(`Failed to install dotnet ${resultCode}. ${output}`); } } @@ -236,7 +243,9 @@ export class DotnetCoreInstaller { ); 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]; @@ -264,9 +273,11 @@ export class DotnetCoreInstaller { }); 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']; From 20afff9c90f1ba52c7fc7198759eba900832b4cf Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Wed, 17 Mar 2021 14:56:08 +0300 Subject: [PATCH 03/14] work on fixing test --- __tests__/versionutil.test.ts | 1 - dist/index.js | 12 +++--------- src/installer.ts | 11 +++-------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/__tests__/versionutil.test.ts b/__tests__/versionutil.test.ts index a238688..b816013 100644 --- a/__tests__/versionutil.test.ts +++ b/__tests__/versionutil.test.ts @@ -42,7 +42,6 @@ describe('version tests', () => { '.2.3', '.2.x', '1', - '2.x', '*.*.1', '*.1', '*.', diff --git a/dist/index.js b/dist/index.js index aadf381..9febcc2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16869,20 +16869,14 @@ class DotNetVersionInfo { return; } //Note: No support for previews when using generic - let parts = version.split('.'); + const parts = version.split('.'); if (parts.length < 2 || parts.length > 3) this.throwInvalidVersionFormat(); if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') { this.throwInvalidVersionFormat(); } - let major = this.getVersionNumberOrThrow(parts[0]); - let minor; - if (parts[1] === 'x') { - minor = parts[1]; - } - else { - minor = this.getVersionNumberOrThrow(parts[1]); - } + const major = this.getVersionNumberOrThrow(parts[0]); + const minor = ['x', '*'].includes(parts[1]) ? parts[1] : this.getVersionNumberOrThrow(parts[1]); this.fullversion = major + '.' + minor; } getVersionNumberOrThrow(input) { diff --git a/src/installer.ts b/src/installer.ts index 12113e6..0f3fc42 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -30,7 +30,7 @@ export class DotNetVersionInfo { } //Note: No support for previews when using generic - let parts: string[] = version.split('.'); + const parts: string[] = version.split('.'); if (parts.length < 2 || parts.length > 3) this.throwInvalidVersionFormat(); @@ -38,13 +38,8 @@ export class DotNetVersionInfo { this.throwInvalidVersionFormat(); } - let major = this.getVersionNumberOrThrow(parts[0]); - let minor; - if (parts[1] === 'x') { - minor = parts[1]; - } else { - minor = this.getVersionNumberOrThrow(parts[1]); - } + const major = this.getVersionNumberOrThrow(parts[0]); + const minor = ['x', '*'].includes(parts[1]) ? parts[1] : this.getVersionNumberOrThrow(parts[1]); this.fullversion = major + '.' + minor; } From 6930747f7f2406e54bf60cd86f4e425fb11b7b65 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Wed, 17 Mar 2021 14:58:04 +0300 Subject: [PATCH 04/14] create release --- dist/index.js | 4 +++- src/installer.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9febcc2..d80bc1e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16876,7 +16876,9 @@ class DotNetVersionInfo { this.throwInvalidVersionFormat(); } const major = this.getVersionNumberOrThrow(parts[0]); - const minor = ['x', '*'].includes(parts[1]) ? parts[1] : this.getVersionNumberOrThrow(parts[1]); + const minor = ['x', '*'].includes(parts[1]) + ? parts[1] + : this.getVersionNumberOrThrow(parts[1]); this.fullversion = major + '.' + minor; } getVersionNumberOrThrow(input) { diff --git a/src/installer.ts b/src/installer.ts index 0f3fc42..d0bc4f4 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -39,7 +39,9 @@ export class DotNetVersionInfo { } const major = this.getVersionNumberOrThrow(parts[0]); - const minor = ['x', '*'].includes(parts[1]) ? parts[1] : this.getVersionNumberOrThrow(parts[1]); + const minor = ['x', '*'].includes(parts[1]) + ? parts[1] + : this.getVersionNumberOrThrow(parts[1]); this.fullversion = major + '.' + minor; } From 083d63a2ff6892d228bfb580ea7c7a6e0995c2bf Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Thu, 18 Mar 2021 10:18:52 +0300 Subject: [PATCH 05/14] add yesy cases --- __tests__/versionutil.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__tests__/versionutil.test.ts b/__tests__/versionutil.test.ts index b816013..1eb4697 100644 --- a/__tests__/versionutil.test.ts +++ b/__tests__/versionutil.test.ts @@ -13,6 +13,8 @@ describe('version tests', () => { ); each([ + ['3.x', '3.1'], + ['3.*', '3.1'], ['3.1.x', '3.1'], ['1.1.*', '1.1'], ['2.0', '2.0'] From 385512c5e5b7ecd4b4c3ad07e808b5a96c754f33 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Thu, 18 Mar 2021 11:07:32 +0300 Subject: [PATCH 06/14] fix test --- __tests__/versionutil.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/versionutil.test.ts b/__tests__/versionutil.test.ts index 1eb4697..69681da 100644 --- a/__tests__/versionutil.test.ts +++ b/__tests__/versionutil.test.ts @@ -13,8 +13,8 @@ describe('version tests', () => { ); each([ - ['3.x', '3.1'], - ['3.*', '3.1'], + ['3.x', '3.x'], + ['3.*', '3.*'], ['3.1.x', '3.1'], ['1.1.*', '1.1'], ['2.0', '2.0'] From 3707a44789a14a0c870cbc513c20b3d7d9f22960 Mon Sep 17 00:00:00 2001 From: GGG KILLER Date: Thu, 25 Mar 2021 20:07:28 -0300 Subject: [PATCH 07/14] Remove unsupported versions of .NET from README. .NET Core 2.2 and 3.0 are no longer supported and should not be in the examples. All versions were changed to pull in the latest revision as people might copy this without checking all accepted version formats and getting the latest revision is good security practice. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 66af02f..8eb074b 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest strategy: 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 steps: - uses: actions/checkout@v2 @@ -59,7 +59,7 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: '2.2.103' + dotnet-version: '2.1.x' - name: Setup dotnet uses: actions/setup-dotnet@v1 with: @@ -113,7 +113,7 @@ build: - uses: actions/checkout@main - uses: actions/setup-dotnet@v1 with: - dotnet-version: '3.1.100' # SDK Version to use. + dotnet-version: '3.1.x' # SDK Version to use. ``` # License From 8dcf1ee9bc0f504f4e83b72cbb4b6401c9598b4c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Mar 2021 22:18:10 +0000 Subject: [PATCH 08/14] Bump y18n from 4.0.0 to 4.0.1 Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index da3c738..e5a85ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5342,9 +5342,9 @@ "dev": true }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yaml": { From f2eb44dadd6e1963e97bf8633e8a2391ecd5167b Mon Sep 17 00:00:00 2001 From: Andreas Offenhaeuser Date: Mon, 5 Apr 2021 21:35:43 +0900 Subject: [PATCH 09/14] Update link to pre-installed runner Software --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 66af02f..d876e29 100644 --- a/README.md +++ b/README.md @@ -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 preinstalled. Installed versions are subject to change. Please refer to the 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. # Usage From 632ccbdfb97bc4aa7484106496626056c0589dd2 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 19 Apr 2021 14:25:42 +0300 Subject: [PATCH 10/14] Support nuget.config name formats --- src/authutil.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/authutil.ts b/src/authutil.ts index 463f0d3..e625f06 100644 --- a/src/authutil.ts +++ b/src/authutil.ts @@ -13,7 +13,7 @@ export function configAuthentication( ) { const existingNuGetConfig: string = path.resolve( processRoot, - existingFileLocation == '' ? 'nuget.config' : existingFileLocation + existingFileLocation == '' ? getExistingNugetConfig(processRoot) : existingFileLocation ); const tempNuGetConfig: string = path.resolve( @@ -25,6 +25,14 @@ export function configAuthentication( writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig); } +function getExistingNugetConfig(processRoot: string) { + const configFileNames = fs.readdirSync(processRoot).filter(filename => filename.toLowerCase() == 'nuget.config') + if (configFileNames.length) { + return configFileNames[0]; + } + return 'nuget.config'; +} + function writeFeedToFile( feedUrl: string, existingFileLocation: string, From d08d2193f9160552a35531296eb3fb6a8ce4027a Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 19 Apr 2021 14:26:05 +0300 Subject: [PATCH 11/14] Prettier --- src/authutil.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/authutil.ts b/src/authutil.ts index e625f06..54a2d3f 100644 --- a/src/authutil.ts +++ b/src/authutil.ts @@ -13,7 +13,9 @@ export function configAuthentication( ) { const existingNuGetConfig: string = path.resolve( processRoot, - existingFileLocation == '' ? getExistingNugetConfig(processRoot) : existingFileLocation + existingFileLocation == '' + ? getExistingNugetConfig(processRoot) + : existingFileLocation ); const tempNuGetConfig: string = path.resolve( @@ -26,7 +28,9 @@ export function configAuthentication( } function getExistingNugetConfig(processRoot: string) { - const configFileNames = fs.readdirSync(processRoot).filter(filename => filename.toLowerCase() == 'nuget.config') + const configFileNames = fs + .readdirSync(processRoot) + .filter(filename => filename.toLowerCase() == 'nuget.config'); if (configFileNames.length) { return configFileNames[0]; } From 07b4a80293787dc359f76a18cb064efc41b5719b Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 19 Apr 2021 14:26:52 +0300 Subject: [PATCH 12/14] Build index.js --- dist/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 15f8a3b..199f644 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4840,11 +4840,22 @@ const github = __importStar(__webpack_require__(469)); const xmlbuilder = __importStar(__webpack_require__(312)); const xmlParser = __importStar(__webpack_require__(989)); 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'); writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig); } exports.configAuthentication = configAuthentication; +function getExistingNugetConfig(processRoot) { + const configFileNames = fs + .readdirSync(processRoot) + .filter(filename => filename.toLowerCase() == 'nuget.config'); + if (configFileNames.length) { + return configFileNames[0]; + } + return 'nuget.config'; +} 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}`); let xml; From a8c97016ef885352c99d116af10e48786cda01ca Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 19 Apr 2021 16:11:14 +0300 Subject: [PATCH 13/14] Minor fix --- dist/index.js | 4 ++-- src/authutil.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 199f644..3b057b7 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4840,7 +4840,7 @@ const github = __importStar(__webpack_require__(469)); const xmlbuilder = __importStar(__webpack_require__(312)); const xmlParser = __importStar(__webpack_require__(989)); function configAuthentication(feedUrl, existingFileLocation = '', processRoot = process.cwd()) { - const existingNuGetConfig = path.resolve(processRoot, existingFileLocation == '' + const existingNuGetConfig = path.resolve(processRoot, existingFileLocation === '' ? getExistingNugetConfig(processRoot) : existingFileLocation); const tempNuGetConfig = path.resolve(processRoot, '../', 'nuget.config'); @@ -4850,7 +4850,7 @@ exports.configAuthentication = configAuthentication; function getExistingNugetConfig(processRoot) { const configFileNames = fs .readdirSync(processRoot) - .filter(filename => filename.toLowerCase() == 'nuget.config'); + .filter(filename => filename.toLowerCase() === 'nuget.config'); if (configFileNames.length) { return configFileNames[0]; } diff --git a/src/authutil.ts b/src/authutil.ts index 54a2d3f..77d66f6 100644 --- a/src/authutil.ts +++ b/src/authutil.ts @@ -13,7 +13,7 @@ export function configAuthentication( ) { const existingNuGetConfig: string = path.resolve( processRoot, - existingFileLocation == '' + existingFileLocation === '' ? getExistingNugetConfig(processRoot) : existingFileLocation ); @@ -30,7 +30,7 @@ export function configAuthentication( function getExistingNugetConfig(processRoot: string) { const configFileNames = fs .readdirSync(processRoot) - .filter(filename => filename.toLowerCase() == 'nuget.config'); + .filter(filename => filename.toLowerCase() === 'nuget.config'); if (configFileNames.length) { return configFileNames[0]; } From 3edf2e9363275b7fcf1d3210aa362f26c07287ab Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Mon, 19 Apr 2021 16:16:44 +0300 Subject: [PATCH 14/14] Minor fix --- dist/index.js | 5 +++-- src/authutil.ts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 3b057b7..28caa4a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4848,13 +4848,14 @@ function configAuthentication(feedUrl, existingFileLocation = '', processRoot = } exports.configAuthentication = configAuthentication; function getExistingNugetConfig(processRoot) { + const defaultConfigName = 'nuget.config'; const configFileNames = fs .readdirSync(processRoot) - .filter(filename => filename.toLowerCase() === 'nuget.config'); + .filter(filename => filename.toLowerCase() === defaultConfigName); if (configFileNames.length) { return configFileNames[0]; } - return 'nuget.config'; + return defaultConfigName; } 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}`); diff --git a/src/authutil.ts b/src/authutil.ts index 77d66f6..d8ddef0 100644 --- a/src/authutil.ts +++ b/src/authutil.ts @@ -28,13 +28,14 @@ export function configAuthentication( } function getExistingNugetConfig(processRoot: string) { + const defaultConfigName = 'nuget.config'; const configFileNames = fs .readdirSync(processRoot) - .filter(filename => filename.toLowerCase() === 'nuget.config'); + .filter(filename => filename.toLowerCase() === defaultConfigName); if (configFileNames.length) { return configFileNames[0]; } - return 'nuget.config'; + return defaultConfigName; } function writeFeedToFile(