diff --git a/.github/workflows/release-new-action-version.yml b/.github/workflows/release-new-action-version.yml index e72733e..6ef9f1e 100644 --- a/.github/workflows/release-new-action-version.yml +++ b/.github/workflows/release-new-action-version.yml @@ -26,3 +26,4 @@ jobs: with: source-tag: ${{ env.TAG_NAME }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }} + \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 5baa561..1c451ee 100644 --- a/dist/index.js +++ b/dist/index.js @@ -212,7 +212,7 @@ class DotnetVersionResolver { } resolveVersionInput() { return __awaiter(this, void 0, void 0, function* () { - if (!this.isValidVersion(this.inputVersion)) { + if (!semver_1.default.validRange(this.inputVersion)) { throw new Error(`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x`); } if (semver_1.default.valid(this.inputVersion)) { @@ -238,9 +238,6 @@ class DotnetVersionResolver { } }); } - isValidVersion(version) { - return semver_1.default.valid(version) || semver_1.default.validRange(version) ? true : false; - } isNumericTag(versionTag) { return /^\d+$/.test(versionTag); } @@ -358,7 +355,8 @@ class DotnetCoreInstaller { } scriptArguments.push(`-InstallDir '${DotnetCoreInstaller.installationDirectoryWindows}'`); // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used - scriptPath = yield io.which('powershell', true); + scriptPath = + (yield io.which('powershell', false)) || (yield io.which('pwsh', true)); scriptArguments = [...windowsDefaultOptions, scriptArguments.join(' ')]; } else { diff --git a/src/installer.ts b/src/installer.ts index 8f3b16c..116cc5a 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -42,7 +42,7 @@ export class DotnetVersionResolver { } private async resolveVersionInput(): Promise { - if (!this.isValidVersion(this.inputVersion)) { + if (!semver.validRange(this.inputVersion)) { throw new Error( `'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x` ); @@ -72,10 +72,6 @@ export class DotnetVersionResolver { } } - private isValidVersion(version) { - return semver.valid(version) || semver.validRange(version) ? true : false; - } - private isNumericTag(versionTag): Boolean { return /^\d+$/.test(versionTag); } @@ -237,7 +233,8 @@ export class DotnetCoreInstaller { `-InstallDir '${DotnetCoreInstaller.installationDirectoryWindows}'` ); // process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used - scriptPath = await io.which('powershell', true); + scriptPath = + (await io.which('powershell', false)) || (await io.which('pwsh', true)); scriptArguments = [...windowsDefaultOptions, scriptArguments.join(' ')]; } else { chmodSync(escapedScript, '777');