Skip to content

Commit

Permalink
Fixed issue where the updated SDK is not added to PATH and DOTNET_ROO…
Browse files Browse the repository at this point in the history
…T is not exported.
  • Loading branch information
AraHaan committed Jul 22, 2021
1 parent 4a325b1 commit fe12c9e
Show file tree
Hide file tree
Showing 20 changed files with 963 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ bower_components
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
Expand Down
23 changes: 22 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const https = require("https"),
fs = require("fs"),
spawnSync = require("child_process").spawnSync
path = require("path"),
spawnSync = require("child_process").spawnSync,
core = require("@actions/core")

class Action
{
Expand Down Expand Up @@ -70,11 +72,30 @@ class Action

// Windows.
this._executeCommand(`${__dirname}/dotnet-install.ps1 -Channel ${this.versionMajor}.${this.versionMinor} -Quality daily`, { encoding: "utf-8", stdio: [process.stdin, process.stdout, process.stderr] })
if (!process.env['DOTNET_INSTALL_DIR'])
{
// This is the default set in install-dotnet.ps1
core.addPath(path.join(process.env['LocalAppData'] + '', 'Microsoft', 'dotnet'))
core.exportVariable('DOTNET_ROOT', path.join(process.env['LocalAppData'] + '', 'Microsoft', 'dotnet'))
}
}
else
{
// Linux and MacOS.
this._executeCommand(`${__dirname}/dotnet-install.sh --channel ${this.versionMajor}.${this.versionMinor} --quality daily`, { encoding: "utf-8", stdio: [process.stdin, process.stdout, process.stderr] })
if (!process.env['DOTNET_INSTALL_DIR'])
{
// This is the default set in install-dotnet.sh
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'))
core.exportVariable('DOTNET_ROOT', path.join(process.env['HOME'] + '', '.dotnet'))
}
}

// Add DOTNET_INSTALL_DIR to path and export the variable DOTNET_ROOT if DOTNET_INSTALL_DIR is set.
if (process.env['DOTNET_INSTALL_DIR'])
{
core.addPath(process.env['DOTNET_INSTALL_DIR'])
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR'])
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions node_modules/@actions/core/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

209 changes: 209 additions & 0 deletions node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions node_modules/@actions/core/lib/command.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions node_modules/@actions/core/lib/command.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/@actions/core/lib/command.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fe12c9e

Please sign in to comment.