Compare commits

..

238 Commits

Author SHA1 Message Date
45c9f236cf Enable ability to change .NET SDK installation directory by DOTNET_INSTALL_DIR environment variable (#329) 2022-10-04 10:22:05 +02:00
c7e7147fd3 Add ability to write resolved version of SDK into the output variable (#324) 2022-09-29 17:45:25 +02:00
0705ef0281 Implement proposal stated in ADR for setup-dotnet v3 and functionality from feature request #219 (#315) 2022-09-27 14:47:12 +02:00
a351d9ea84 Add support for Windows-arm (#320)
* update to use pwsh if it is available

* fix spacing

* update install script

* Update src/installer.ts

Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>

* update index.js

* fix format

Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-09-26 10:12:13 +02:00
857c316a9d Merge pull request #313 from panticmilos/vmpantic/update-version-package-json
Update package lock version
2022-09-20 11:36:22 +02:00
bba8299c35 npm run update-installers 2022-09-14 16:08:36 +02:00
fd4e15fa44 Merge pull request #291 from vsafonkin/v-vsafonkin/v3-adr
V3 setup-dotnet ADR
2022-09-14 09:52:09 +02:00
95e7de77d1 Set status accepted 2022-09-13 16:19:35 +02:00
52c3199a78 ADR change (#1)
* Update ADR proposal

ADR proposal was updated in order to reflect cahnges that will be done
more thoroughly.

* Fix formatting
2022-09-13 12:41:55 +02:00
2d9def7067 Rework 2022-09-11 13:42:07 +02:00
df51eabf53 Update package lock version 2022-09-05 13:18:26 +02:00
e4b2fcaa19 Merge pull request #312 from panticmilos/vmpantic/update-version-package-json
Update actions version in package json
2022-09-01 09:44:52 +02:00
d45c10e6f7 Run update installers 2022-08-31 17:40:05 +02:00
4d1b6c2c63 Update actions version in package json 2022-08-31 16:21:24 +02:00
4cb4764ae2 Update ADR date 2022-08-29 11:23:22 +02:00
d33e605efe Grammar fixes 2022-08-24 12:32:58 +02:00
f7747565a1 Merge pull request #305 from e-korolevskii/update-contributors-guide
Update contributors guide
2022-08-10 16:45:38 +02:00
2f75d1de25 Merge branch 'actions:main' into update-contributors-guide 2022-08-10 16:42:02 +02:00
e6a9a96293 Update docs/contributors.md
Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com>
2022-08-09 23:54:52 +02:00
025aba53b2 rephased docs 2022-08-03 19:15:44 +02:00
37b00c4fc5 Merge pull request #250 from nogic1008/refactor/boolean-input
Use `core.getBooleanInput()` to resolve `include-prerelease` option
2022-08-02 15:24:04 +02:00
c2dac7f367 test: add include-prerelease env on test 2022-07-31 23:27:05 +00:00
c5267f5e54 chore: set include-prerelease to false on default 2022-07-31 23:27:05 +00:00
ba5e53c61d refactor: use core.getBooleanInput() 2022-07-31 23:27:05 +00:00
043fb8900f advice on updating installers 2022-08-01 01:10:29 +02:00
cb04ff8cb3 Merge pull request #301 from nogic1008/migrate/husky4-8
Fix husky config to resolve git hook error
2022-07-29 15:19:36 +02:00
bac4044d91 ci: add --ignore-scripts argument 2022-07-29 07:17:54 +00:00
d26ead4cf0 chore(deps-dev): migrate husky config to v8
Follow: https://github.com/typicode/husky-4-to-8
- npm install husky --save-dev
- npx husky-init
- npm exec -- github:typicode/husky-4-to-8 --remove-v4-config
2022-07-29 07:17:54 +00:00
e81cd4d454 Merge pull request #302 from e-korolevskii/scripts-update
Updated local installation scripts
2022-07-29 08:52:45 +02:00
ee11c4faa4 updated guide 2022-07-29 02:02:42 +02:00
8bf1fb6084 updated local installation scripts 2022-07-29 01:22:35 +02:00
c0d4ad69d8 Don't need C# analysis for CodeQL 2022-04-29 13:54:18 -04:00
afe2daba1f Create codeql-analysis.yml 2022-04-29 13:48:41 -04:00
fb09b12527 v3 adr 2022-04-29 11:22:26 +02:00
5cc895510b Update @zeit/ncc to @vercel/ncc (#290)
* update @zeit/ncc to @vercel/ncc

* rebuild project
2022-04-28 11:37:53 +02:00
158737d5b1 Merge pull request #289 from vsafonkin/v-vsafonkin/update-wget-package
Update vulnerable packages
2022-04-21 13:10:39 +03:00
fcf565ec50 Update vulnerable packages 2022-04-21 11:17:56 +02:00
f078482971 add global-json-file input (#276)
* support specifying global.json location with global-json-file input

* add test workflow jobs for global.json usage

* fix typo in global-json-file description

Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>

Co-authored-by: Brian Cristante <33549821+brcrista@users.noreply.github.com>
2022-04-18 08:25:56 -04:00
0fb87b12d2 Merge pull request #285 from vsafonkin/v-vsafonkin/add-code-of-conduct
Add code of conduct
2022-04-15 11:03:29 +03:00
4fe7a196b5 Add code of conduct 2022-04-13 16:58:12 +02:00
9283a8cf7a switch side by side testing example to single setup step (#283) 2022-04-11 11:50:34 -04:00
53d632b5c0 Update docs to v2 (#278)
* Update docs to v2

* Bump checkout action to v3

* Update installer scripts

* Replace v2 to vX on the docs, minor fixes

* Remove extra whitespace
2022-04-01 09:48:47 -04:00
9211491ffb Merge pull request #273 from actions/v-vlsafo/update-deps
Update npm dependencies
2022-02-24 18:33:48 +03:00
edfd7b3266 Update licenses 2022-02-24 18:12:33 +03:00
9744af7b74 Update dependencies 2022-02-24 18:04:55 +03:00
7016f85f93 Merge pull request #271 from vsafonkin/v-vlsafo/update-node-version
Update default runtime to node16
2022-02-24 17:29:31 +03:00
d292011f5d Update node version to v16 2022-02-24 11:16:01 +03:00
608ee757cf Merge pull request #270 from snickler/main
Updated dotnet-install scripts to latest version
2022-02-22 16:38:32 +03:00
e54e706650 Updated dotnet-install scripts to latest version 2022-02-19 17:07:00 -05:00
c20f59e04a Avoiding installing the same version multiple times (#252) 2021-12-29 14:07:42 +03:00
13b852df87 Moved checkout above setup step to align with the other samples (#256) 2021-12-28 15:37:44 +03:00
f85bcda870 Fix the Licensed workflow (#258) 2021-12-23 14:35:09 +03:00
499789684c Warn users when installing EOL .NET versions (#245) 2021-11-23 16:58:49 +03:00
76ddd67c90 Fix a space in the documentation (#248) 2021-11-23 16:56:22 +03:00
550702114f Support multiple versions in single invocation (#240) 2021-11-23 13:03:56 +03:00
e3ce4164b3 Merge pull request #238 from vsafonkin/v-vlsafo/fix-dependencies
Update dependencies and installer scripts
2021-10-13 17:24:51 +03:00
463326422f Update jest 2021-10-13 16:35:23 +03:00
547d075822 Revert jest version 2021-10-13 14:58:41 +03:00
fc9265379f Update deps with force 2021-10-13 14:50:32 +03:00
32c76e2669 Update installer scripts 2021-10-13 14:27:43 +03:00
8ca0cf75a1 Update dependencies 2021-10-13 14:20:02 +03:00
7f88dbf08f Merge pull request #231 from actions/dependabot/npm_and_yarn/tmpl-1.0.5
Bump tmpl from 1.0.4 to 1.0.5
2021-10-13 11:12:15 +03:00
af0ed6536b Bump tmpl from 1.0.4 to 1.0.5
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-13 07:14:28 +00:00
9dd9d27e57 Merge pull request #234 from IEvangelist/patch-1
Update README.md
2021-10-12 17:27:43 +03:00
44530e8569 Update README.md
Fix the README.md file to avoid the .NET CLI repo link that is now the .NET SDK repo.
2021-10-05 10:05:48 -05:00
5a3fa01c67 Merge pull request #222 from actions/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2021-09-14 10:17:28 +03:00
f2da928c08 Merge pull request #224 from vsafonkin/v-vlsafo/handle-roll-forward-option
Support `rollForward` option from `global.json` file
2021-09-13 10:09:01 +03:00
fb9fd97b03 Merge remote-tracking branch 'upstream/main' into v-vlsafo/handle-roll-forward-option 2021-08-30 17:40:23 +03:00
f0b9e4cf3f Merge pull request #225 from brcrista/brcrista/check-dist
Create check-dist.yml
2021-08-30 17:38:46 +03:00
b66058b059 Build index.js 2021-08-30 17:35:17 +03:00
7323c4e7cb Merge remote-tracking branch 'upstream/main' into v-vlsafo/handle-roll-forward-option 2021-08-30 17:31:17 +03:00
6eab455d72 Merge pull request #226 from vsafonkin/v-vlsafo/update-installers-scripts
Update installers scripts
2021-08-30 17:28:39 +03:00
b2cf6c7cd4 Handle only latestFeature option 2021-08-30 17:27:01 +03:00
ff5b78971e Merge pull request #227 from tomp736/patch-1
Update README.md
2021-08-30 09:57:40 +03:00
e26fc623bc Update README.md
fix docs
2021-08-29 14:56:20 +02:00
e974974b42 Update installers scripts 2021-08-26 12:44:10 +03:00
9969bca445 Fix triggers in licensed.yml 2021-08-25 11:29:43 -04:00
deee0f6246 Add check-dist.yml 2021-08-25 11:29:42 -04:00
33fad1d142 Format code 2021-08-20 17:28:30 +03:00
2c3efd1f04 Improve condition 2021-08-20 17:28:10 +03:00
f3822c3b02 Prettier 2021-08-20 17:13:23 +03:00
5e45b4b591 Remove hardcoded patch version from unit test 2021-08-20 17:11:48 +03:00
b7b99f337e Fix unit test 2021-08-20 16:54:24 +03:00
f92687c910 Minor fix 2021-08-20 16:47:49 +03:00
0067f023d2 Fix unstaged changes in index.js 2021-08-20 16:45:26 +03:00
9480036ff9 Fix unit test 2021-08-20 16:35:44 +03:00
6b8ad2e725 Revert exports in index.js 2021-08-20 15:48:47 +03:00
078f7c4a73 Format code 2021-08-20 15:44:47 +03:00
13fd5bf191 Support rollForward option from global.json 2021-08-20 15:43:49 +03:00
26be14c4e1 Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-11 08:44:30 +00:00
8309d4ee7e Merge pull request #220 from 0xfeeddeadbeef/patch-1
Update link to dotnet environment variables docs
2021-07-29 10:25:00 +03:00
bab14f40fd Update link to dotnet environment variables docs
Old: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet#environment-variables
New: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables
2021-07-28 14:48:24 +04:00
4b337272b7 Merge pull request #215 from actions/v-vlsafo/action-description
Rework action description
2021-06-28 13:24:33 +03:00
d62c876481 Rework action description 2021-06-28 13:20:36 +03:00
5306333434 Merge pull request #213 from al-cheb/al-cheb/move-dotnet-dir
Move toolcache folder
2021-06-28 12:09:16 +03:00
5070486392 Move toolcache folder 2021-06-28 11:44:40 +03:00
9647326bcf Merge pull request #212 from actions/dependabot/npm_and_yarn/ws-7.5.0
Bump ws from 7.3.1 to 7.5.0
2021-06-28 11:40:18 +03:00
f720d14d91 Merge pull request #198 from actions/dependabot/npm_and_yarn/hosted-git-info-2.8.9
Bump hosted-git-info from 2.8.8 to 2.8.9
2021-06-28 11:14:17 +03:00
7f3ad75595 Merge pull request #197 from actions/dependabot/npm_and_yarn/lodash-4.17.21
Bump lodash from 4.17.20 to 4.17.21
2021-06-28 11:01:16 +03:00
634914df32 Bump lodash from 4.17.20 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-28 07:44:45 +00:00
4fc55d8fdb Bump ws from 7.3.1 to 7.5.0
Bumps [ws](https://github.com/websockets/ws) from 7.3.1 to 7.5.0.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.3.1...7.5.0)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-28 07:44:32 +00:00
c98cd238db Merge pull request #158 from actions/dependabot/npm_and_yarn/node-notifier-8.0.1
Bump node-notifier from 8.0.0 to 8.0.1
2021-06-28 10:43:59 +03:00
b25fa305a3 Merge remote-tracking branch 'upstream/main' into dependabot/npm_and_yarn/node-notifier-8.0.1 2021-06-28 10:29:43 +03:00
181f10df92 Merge pull request #210 from timheuer/patch-3
Update description for action
2021-06-28 10:21:17 +03:00
c65a26fe6d Merge pull request #204 from vsafonkin/v-vlsafo/update-installers
Update installers scripts
2021-06-28 10:21:03 +03:00
dd9ada314c Update description for action
Fixes #209 by adding a few more terms for search discoverability
2021-06-22 10:57:55 -07:00
12194cb2cd Update installers scripts 2021-06-08 12:27:57 +03:00
b8ab602c41 Merge pull request #191 from MaksimZhukov/v-mazhuk/automate-releasing-new-versions
Automate releasing new versions of the setup-dotnet action
2021-05-27 17:28:39 +03:00
95f03216f8 Use permissions as a top-level key 2021-05-27 16:20:43 +03:00
5529ce4143 Use the "publish-action" action 2021-05-27 14:39:14 +03:00
5b0ff19756 Bump hosted-git-info from 2.8.8 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-11 01:09:33 +00:00
bf3c3eb1fd Merge pull request #196 from Darleev/patch-1
Update README.md
2021-05-06 18:53:19 +03:00
450b569534 Update README.md 2021-05-06 21:38:47 +07:00
e1cf912aaf Update README.md 2021-05-06 20:10:13 +07:00
03d6eb5402 Update README.md 2021-05-06 15:10:43 +07:00
effa3e26d2 Update README.md 2021-05-06 02:55:59 +07:00
a71d1eb2c8 Merge pull request #195 from actions/malob/update-readme
Add preview example to README
2021-05-05 16:49:32 +03:00
b50d70502b Update README.md 2021-05-05 16:47:58 +03:00
d8cff32ae5 Update README.md 2021-05-05 16:45:32 +03:00
7b2009794e Merge pull request #110 from GGG-KILLER/feature/include-prerelease
Include include-prerelease option to be able to match latest prerelease versions
2021-05-05 15:53:38 +03:00
53d6483af8 Merge pull request #192 from dsame/fix/json-bom
Add workaround to fix BOM-related error  during parsing global.json
2021-05-04 18:29:42 +03:00
34c59b7d0b build dist/index.js 2021-04-28 17:29:56 +05:00
bd485b6bd1 Add workaround to fix BOM-related error during parsing global.json 2021-04-28 13:43:02 +05:00
0cfae9b3a5 Automate releasing new versions of the setup-dotnet action 2021-04-26 16:02:03 +03:00
23fa2c1473 Improve key names validation from user' nuget config #187
Improve key names validation from user' nuget config
2021-04-22 18:28:20 +03:00
291588df6a Rerun build 2021-04-22 12:22:10 -03:00
87189a16c7 Merge branch 'main' of https://github.com/actions/setup-dotnet into feature/include-prerelease 2021-04-22 12:21:25 -03:00
cde58ab948 Resolve conflicts 2021-04-22 14:19:03 +03:00
20e68089c2 Merge pull request #178 from actions/dependabot/npm_and_yarn/y18n-4.0.1
Bump y18n from 4.0.0 to 4.0.1
2021-04-22 14:07:23 +03:00
7790315509 Fix for 5.x notation #175 2021-04-22 14:06:54 +03:00
c47e26f841 Support various nuget.config name formats #188 2021-04-22 14:06:13 +03:00
3edf2e9363 Minor fix 2021-04-19 16:16:44 +03:00
a8c97016ef Minor fix 2021-04-19 16:11:14 +03:00
07b4a80293 Build index.js 2021-04-19 14:26:52 +03:00
d08d2193f9 Prettier 2021-04-19 14:26:05 +03:00
632ccbdfb9 Support nuget.config name formats 2021-04-19 14:25:42 +03:00
b81836a248 Fix index.js 2021-04-15 13:57:21 +03:00
3b539379a8 Minor fix 2021-04-15 13:44:48 +03:00
596753d72c Minor fix 2021-04-15 13:43:20 +03:00
f9d7f16c00 Improve key names validation for keys from user nuget config 2021-04-15 13:30:04 +03:00
56d96e897e Improve key names validation for keys from user nuget config 2021-04-15 13:28:24 +03:00
5a201f5e82 Merge pull request #177 from GGG-KILLER/patch-1
Remove unsupported versions of .NET from README
2021-04-08 09:40:20 +03:00
13ccc115f4 Merge pull request #183 from anoff/patch-1
Update link to pre-installed runner Software
2021-04-08 09:39:48 +03:00
f2eb44dadd Update link to pre-installed runner Software 2021-04-05 21:35:43 +09:00
8dcf1ee9bc 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] <support@github.com>
2021-03-30 22:18:10 +00:00
3707a44789 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.
2021-03-25 20:07:28 -03:00
385512c5e5 fix test 2021-03-18 11:07:32 +03:00
083d63a2ff add yesy cases 2021-03-18 10:18:52 +03:00
6930747f7f create release 2021-03-17 14:58:04 +03:00
20afff9c90 work on fixing test 2021-03-17 14:56:08 +03:00
36fa9877a9 try fixing 5.x issue 2021-03-17 12:38:57 +03:00
77a48bbb85 Merge pull request #174 from actions/v-malob/update-codeowners
Add @actions/virtual-environments-owners to CODEOWNERS file
2021-03-05 09:36:43 +03:00
4f71fcfa81 Add @actions/virtual-environments-owners to CODEOWNERS file 2021-03-04 21:24:09 +03:00
768b4eb7db Implement passing includePrerelase to semver 2021-02-19 13:33:36 -03:00
ba7e1e2155 Include include-prerelease input in action.yml 2021-02-19 13:29:15 -03:00
6803d4b94d Merge pull request #166 from vsafonkin/v-vlsafo/update-installer-scripts
Update installer scripts
2021-02-11 10:45:53 +03:00
3c80e97cbd Update Linux installer 2021-02-11 10:32:14 +03:00
8d30c127da Merge pull request #168 from dmitry-shibanov/restrict-blank-issues
Restrict blank issues
2021-02-11 10:24:30 +03:00
2d101adc9f restrict blank issues 2021-02-10 19:12:20 +03:00
c8b60fb6bf Merge pull request #129 from actions/noaction
Action input text update for version
2021-02-10 16:55:10 +03:00
bea420f2fd Improve tests coverage
Rework tests
2021-02-05 12:39:37 +03:00
3a3dbe976e Merge pull request #164 from vsafonkin/v-vlsafo/issue-and-pr-templates
Add issue and pull request templates
2021-02-05 11:24:39 +03:00
ce38f90a9a Update installer scripts 2021-02-05 11:21:42 +03:00
c32ed2108b Debug 2021-02-05 10:44:00 +03:00
d99c06115d Debug 2021-02-05 10:32:37 +03:00
f311b6d978 Debug 2021-02-05 10:27:32 +03:00
9427b17c42 Minor fix 2021-02-05 10:18:34 +03:00
f39691d155 Debug 2021-02-05 10:16:43 +03:00
19e6ad3fe0 Add tests 2021-02-05 10:12:47 +03:00
efeb86e5ce Minor fixes 2021-02-04 18:48:16 +03:00
8e5c71c8f8 Set ubuntu-latest 2021-02-04 18:26:17 +03:00
c0d7255256 Rework cleanup script 2021-02-04 15:14:09 +03:00
c1ca14bb7b Rename stages 2021-02-04 14:33:49 +03:00
e1655545c1 Minor fix 2021-02-04 14:24:06 +03:00
2a58294d0c Minor fix 2021-02-04 14:09:28 +03:00
92ffa484b1 Minor fix 2021-02-04 14:02:30 +03:00
3698118d95 Minor fix 2021-02-04 13:57:55 +03:00
cfb7e25be1 Minor fix 2021-02-04 13:55:28 +03:00
5865234247 Minor fix 2021-02-04 13:54:21 +03:00
0cb99b2a12 Debug 2021-02-04 13:53:22 +03:00
4a01d86a5b Debug 2021-02-04 13:48:03 +03:00
1c7be1087d Debug 2021-02-04 13:41:45 +03:00
ac1baccba4 Minor fix 2021-02-04 13:30:33 +03:00
92451e3d46 Remove workflow dispatch event 2021-02-04 13:27:35 +03:00
a841c568fd Minor fixes 2021-02-04 13:26:18 +03:00
5d1a72cb19 Debug 2021-02-04 12:39:11 +03:00
8889c6748f Debug 2021-02-04 12:31:39 +03:00
f4159a6d20 Debug 2021-02-04 12:22:20 +03:00
7164f75e01 Debug 2021-02-04 12:18:06 +03:00
44b8627225 Debug 2021-02-04 11:49:04 +03:00
054db1cac2 Debug 2021-02-04 11:43:20 +03:00
1317beb53a Debug 2021-02-04 11:20:55 +03:00
fabe7d52fe Debug 2021-02-04 11:06:13 +03:00
993f819e3d Debug 2021-02-04 10:45:20 +03:00
831e0d4070 Debug 2021-02-04 10:36:14 +03:00
bb2233aaa5 Debug 2021-02-04 10:17:46 +03:00
24ed2d0102 Debug 2021-02-04 10:06:12 +03:00
059f1aa99b Debug 2021-02-04 09:57:09 +03:00
5c5ac76dc6 Debug 2021-02-04 09:43:21 +03:00
a0f70ab98c Debug 2021-02-04 09:38:45 +03:00
5dcd27b0bc Add nuget config file 2021-02-04 09:34:53 +03:00
79735df611 Debug 2021-02-04 09:31:18 +03:00
a1105722ad Debug 2021-02-04 09:27:28 +03:00
131ac602dc Debug 2021-02-04 09:22:50 +03:00
c8cb48ba8b Debug 2021-02-04 09:19:10 +03:00
7bbfec324f Debug 2021-02-03 17:46:39 +03:00
6b7d951977 Debug 2021-02-03 17:13:32 +03:00
c7eaa2ec00 Debug 2021-02-03 17:03:23 +03:00
8807004b20 Minor fix 2021-02-03 16:54:18 +03:00
2d640ec739 Debug 2021-02-03 16:47:26 +03:00
53b5bae1f6 Debug 2021-02-03 16:32:31 +03:00
45c0959fcd Debug 2021-02-03 16:24:26 +03:00
d33a835564 Debug 2021-02-03 16:18:47 +03:00
347456b934 Debug 2021-02-03 16:15:36 +03:00
76a91b1af8 Debug 2021-02-03 16:10:28 +03:00
9d49fb8e98 Debug 2021-02-03 15:54:50 +03:00
10ad86dc12 Debug 2021-02-03 15:40:37 +03:00
71f0d4bd07 Debug 2021-02-03 15:34:01 +03:00
7669e56997 Debug 2021-02-03 15:31:11 +03:00
c8cf369c29 Debug 2021-02-03 15:20:22 +03:00
6ade6c061b Minor fix 2021-02-03 15:17:48 +03:00
843b5197ce Debug 2021-02-03 15:15:56 +03:00
a3d47e556c Debug 2021-02-03 15:13:32 +03:00
7261940ea5 Debug 2021-02-03 14:56:08 +03:00
8ada5b5558 Debug 2021-02-03 14:42:33 +03:00
62230c5409 Move toolcache cleanup to separated script 2021-02-03 14:37:15 +03:00
51b6fb2610 Rework feature request template 2021-02-03 13:08:40 +03:00
c47b497cff Minor fix 2021-02-03 12:04:13 +03:00
975b958e4c Debug 2021-02-03 10:59:17 +03:00
13bccd131e Merge remote-tracking branch 'upstream/main' into v-vlsafo/issue-and-pr-templates 2021-02-02 17:53:33 +03:00
daad66578a Resolve comments 2021-02-02 17:53:24 +03:00
29c0c6cee8 Update installer scripts
Update installer scripts
2021-02-02 14:13:27 +03:00
5551aab1c3 Update installer scripts 2021-02-02 11:40:17 +03:00
9a46dbb681 Add issue and pr templates 2021-02-02 10:41:51 +03:00
9fdd50a4bb Bump node-notifier from 8.0.0 to 8.0.1
Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/mikaelbr/node-notifier/releases)
- [Changelog](https://github.com/mikaelbr/node-notifier/blob/v8.0.1/CHANGELOG.md)
- [Commits](https://github.com/mikaelbr/node-notifier/compare/v8.0.0...v8.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-22 08:02:59 +00:00
8336fd394b Update contributors.md 2020-10-08 10:51:05 -07:00
51f68377c1 Update @actions/core Version and move towards uses environment files to talk to runner (#135)
* update toolkit version

* update licensed

* fix typo
2020-09-29 08:12:29 -07:00
8aad93f856 Action input text update 2020-09-21 14:11:39 -07:00
45 changed files with 28119 additions and 19005 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1 @@
* @actions/virtual-environments-owners

View File

@ -2,22 +2,31 @@
name: Bug report
about: Create a bug report
title: ''
labels: ''
labels: bug, needs triage
assignees: ''
---
### Description
**Description:**
A clear and concise description of what the bug is.
<!--
* Please share short description of the problem
-->
**Task version:**
Specify the task version
### Details
**Platform:**
- [ ] Ubuntu
- [ ] macOS
- [ ] Windows
<!--
* Include the relevant yaml, platform, and dotnet versions in use
* If an error occurred on a public action, please share a link
* Include any error messages received in text (search does not work for images)
* Was this a regression from previous behavior?
-->
**Runner type:**
- [ ] Hosted
- [ ] Self-hosted
**Repro steps:**
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.
**Expected behavior:**
A description of what you expected to happen.
**Actual behavior:**
A description of what is actually happening.

View File

@ -1,4 +1,4 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: .NET issues
url: https://github.com/dotnet/runtime#filing-issues

View File

@ -0,0 +1,16 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature request, needs triage
assignees: ''
---
**Description:**
Describe your proposal.
**Justification:**
Justification or a use case for your proposal.
**Are you willing to submit a PR?**
<!--- We accept contributions! -->

9
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,9 @@
**Description:**
Describe your changes.
**Related issue:**
Add link to the related issue.
**Check list:**
- [ ] Mark if documentation changes are required.
- [ ] Mark if tests were added or updated to cover the changes.

52
.github/workflows/check-dist.yml vendored Normal file
View File

@ -0,0 +1,52 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Rebuild the dist/ directory
run: npm run build
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

70
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '23 19 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@ -1,20 +1,25 @@
name: Licensed
on:
push: {branches: main}
pull_request: {branches: main}
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
name: Check licenses
steps:
- uses: actions/checkout@v2
- run: npm ci
- uses: actions/checkout@v3
- run: npm ci --ignore-scripts
- name: Install licensed
run: |
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status
- run: licensed status

View File

@ -0,0 +1,28 @@
name: Release new action version
on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
permissions:
contents: write
jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
environment:
name: releaseNewActionVersion
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag
uses: actions/publish-action@v0.2.0
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

37
.github/workflows/test-dotnet.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: Validate dotnet
on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- main
- releases/*
paths-ignore:
- '**.md'
jobs:
setup-version:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: ./
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Check installed version
shell: pwsh
run: |
$version = & dotnet --version
Write-Host "Installed version: $version"
if (-not $version.StartsWith("${{ matrix.dotnet-version }}")) { throw "Unexpected version" }

View File

@ -2,10 +2,14 @@ name: Main workflow
on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- main
- releases/*
paths-ignore:
- '**.md'
jobs:
build:
@ -16,12 +20,13 @@ jobs:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Node.js 12
uses: actions/setup-node@v1
uses: actions/checkout@v3
- name: Set Node.js 16
uses: actions/setup-node@v3
with:
node-version: 12.x
- run: npm ci
node-version: 16.x
cache: npm
- run: npm ci --ignore-scripts
- run: npm run build
- run: npm run format-check
- run: npm test
@ -29,7 +34,7 @@ jobs:
if: runner.os != 'windows'
run: __tests__/verify-no-unstaged-changes.sh
test:
test-setup-multiple-versions:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
@ -37,26 +42,33 @@ jobs:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Clear tool cache (macOS)
if: runner.os == 'macos'
run: |
echo $PATH
dotnet --info
rm -rf "/Users/runner/.dotnet"
- name: Clear tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
echo $PATH
dotnet --info
rm -rf "/usr/share/dotnet"
- name: Clear tool cache (Windows)
if: runner.os == 'windows'
run: |
echo $env:PATH
dotnet --info
Remove-Item $env:LocalAppData\Microsoft\dotnet/* -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramFiles\dotnet/*" -Recurse -Force -ErrorAction SilentlyContinue
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 2.2.402 and 3.1.404
uses: ./
with:
dotnet-version: |
2.2.402
3.1.404
3.0.x
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 2.2.402 3.1.404 '3.0'
test-setup-full-version:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
# Side-by-side install of 2.2 and 3.1 used for the test project
- name: Setup dotnet 2.2.402
uses: ./
@ -66,71 +78,219 @@ jobs:
uses: ./
with:
dotnet-version: 3.1.201
# We are including this veriable to force the generation of the nuget config file to verify that it is created in the correct place
# We are including this variable to force the generation of the nuget config file to verify that it is created in the correct place
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: NOTATOKEN
- name: Verify nuget config file
shell: pwsh
run: |
if (-Not (Test-Path "../nuget.config")) { throw "nuget file not generated correctly" }
- name: Verify dotnet
if: runner.os != 'windows'
run: __tests__/verify-dotnet.sh 3.1.201 2.2.402
- name: Verify dotnet (Windows)
if: runner.os == 'windows'
shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1.201 2.2.402
# Set new cache before 2 digit install
- name: Set new tool cache (macOS)
if: runner.os == 'macos'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::/Users/runner/.dotnet2"
- name: Set new tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::/home/runner/.dotnet2"
- name: Set new tool cache (Windows)
if: runner.os == 'windows'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::$env:LocalAppData\Microsoft\dotnet2"
test-setup-without-patch-version:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
# 2.0, 3.0, 5.0 needs to be in single quotes to interpret as a string instead of as an integer
- name: Setup dotnet '2.0'
- name: Setup dotnet '3.1'
uses: ./
with:
dotnet-version: '2.0'
dotnet-version: '3.1'
- name: Setup dotnet '2.2'
uses: ./
with:
dotnet-version: '2.2'
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1 2.2
# Clear cache before .x version install
- name: Set new tool cache (macOS)
if: runner.os == 'macos'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::/Users/runner/.dotnet3"
- name: Set new tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::/home/runner/.dotnet3"
- name: Set new tool cache (Windows)
if: runner.os == 'windows'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::$env:LocalAppData\Microsoft\dotnet3"
- name: Setup dotnet 2.0.x
test-setup-prerelease-version:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet '2.2'
uses: ./
with:
dotnet-version: 2.0.x
dotnet-version: '2.2'
- name: Setup dotnet '3.1.100-preview1-014459'
uses: ./
with:
dotnet-version: '3.1.100-preview1-014459'
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1.100-preview1-014459
# Clear cache before .* version install
- name: Set new tool cache (macOS)
if: runner.os == 'macos'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::/Users/runner/.dotnet4"
- name: Set new tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::/home/runner/.dotnet4"
- name: Set new tool cache (Windows)
if: runner.os == 'windows'
run: |
echo "::set-env name=DOTNET_INSTALL_DIR::$env:LocalAppData\Microsoft\dotnet4"
- name: Setup dotnet 2.0.*
test-setup-latest-patch-version:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 3.1.x
uses: ./
with:
dotnet-version: 2.0.*
dotnet-version: 3.1.x
- name: Setup dotnet 2.2.X
uses: ./
with:
dotnet-version: 2.2.X
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 '2.2' '3.1'
test-setup-with-wildcard:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 3.1.*
uses: ./
with:
dotnet-version: 3.1.*
- name: Setup dotnet 2.2.*
uses: ./
with:
dotnet-version: 2.2.*
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1 2.2
test-setup-global-json-specified-and-version:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Write global.json
shell: bash
run: |
mkdir subdirectory
echo '{"sdk":{"version": "2.2","rollForward": "latestFeature"}}' > ./subdirectory/global.json
- name: Setup dotnet
uses: ./
with:
dotnet-version: 3.1
global-json-file: ./subdirectory/global.json
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 2.2 3.1
test-setup-with-dotnet-quality:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 7.0 with preview quality
uses: ./
with:
dotnet-version: "7.0"
dotnet-quality: "preview"
- name: Verify preview version
shell: pwsh
run: |
$version = & dotnet --version
Write-Host "Installed version: $version"
if (-not ($version.Contains("preview") -or $version.Contains("rc"))) { throw "Unexpected version" }
test-dotnet-version-output-during-single-version-installation:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 6.0.401
uses: ./
id: step1
with:
dotnet-version: "6.0.401"
- name: Verify value of the dotnet-version output
shell: pwsh
run: |
$version = & dotnet --version
Write-Host "Installed version: $version"
if (-not ($version -eq '${{steps.step1.outputs.dotnet-version}}')) { throw "Unexpected output value" }
test-dotnet-version-output-during-multiple-version-installation:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 6.0.401, 5.0.408, 7.0.100-rc.1.22431.12
uses: ./
id: step2
with:
dotnet-version: |
7.0.100-rc.1.22431.12
6.0.401
5.0.408
- name: Verify value of the dotnet-version output
shell: pwsh
run: |
$version = "7.0.100-rc.1.22431.12"
if (-not ($version -eq '${{steps.step2.outputs.dotnet-version}}')) { throw "Unexpected output value" }
test-proxy:
runs-on: ubuntu-latest
@ -147,7 +307,7 @@ jobs:
http_proxy: http://squid-proxy:3128
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Clear tool cache
run: rm -rf "/usr/share/dotnet"
- name: Install curl
@ -171,7 +331,7 @@ jobs:
no_proxy: github.com,dotnetcli.blob.core.windows.net,download.visualstudio.microsoft.com,api.nuget.org,dotnetcli.azureedge.net
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Clear tool cache
run: rm -rf "/usr/share/dotnet"
- name: Setup dotnet 3.1.201

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run format

5
.husky/pre-push Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# Tests are not run at push time since they can take 2-4 minutes to complete
npm run format-check

View File

@ -1,6 +1,6 @@
---
name: "@actions/core"
version: 1.2.5
version: 1.9.1
type: npm
summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core

View File

@ -1,30 +1,20 @@
---
name: "@actions/exec"
version: 1.0.4
version: 1.1.1
type: npm
summary: Actions exec lib
homepage: https://github.com/actions/toolkit/tree/master/packages/exec
homepage: https://github.com/actions/toolkit/tree/main/packages/exec
license: mit
licenses:
- sources: Auto-generated MIT license text
text: |
MIT License
- sources: LICENSE.md
text: |-
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright 2019 GitHub
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@ -1,9 +1,9 @@
---
name: "@actions/http-client"
version: 1.0.8
version: 2.0.1
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/http-client#readme
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
license: mit
licenses:
- sources: LICENSE

View File

@ -1,30 +1,20 @@
---
name: "@actions/io"
version: 1.0.2
version: 1.1.2
type: npm
summary: Actions io lib
homepage: https://github.com/actions/toolkit/tree/master/packages/io
homepage: https://github.com/actions/toolkit/tree/main/packages/io
license: mit
licenses:
- sources: Auto-generated MIT license text
text: |
MIT License
- sources: LICENSE.md
text: |-
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright 2019 GitHub
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@ -1,6 +1,6 @@
---
name: node-fetch
version: 2.6.1
version: 2.6.7
type: npm
summary: A light-weight module that brings window.fetch to node.js
homepage: https://github.com/bitinn/node-fetch

30
.licenses/npm/tr46.dep.yml generated Normal file
View File

@ -0,0 +1,30 @@
---
name: tr46
version: 0.0.3
type: npm
summary: An implementation of the Unicode TR46 spec
homepage: https://github.com/Sebmaster/tr46.js#readme
license: mit
licenses:
- sources: Auto-generated MIT license text
text: |
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []

20
.licenses/npm/uuid.dep.yml generated Normal file
View File

@ -0,0 +1,20 @@
---
name: uuid
version: 8.3.2
type: npm
summary: RFC4122 (v1, v4, and v5) UUIDs
homepage:
license: mit
licenses:
- sources: LICENSE.md
text: |
The MIT License (MIT)
Copyright (c) 2010-2020 Robert Kieffer and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

23
.licenses/npm/webidl-conversions.dep.yml generated Normal file
View File

@ -0,0 +1,23 @@
---
name: webidl-conversions
version: 3.0.1
type: npm
summary: Implements the WebIDL algorithms for converting to and from JavaScript values
homepage:
license: bsd-2-clause
licenses:
- sources: LICENSE.md
text: |
# The BSD 2-Clause License
Copyright (c) 2014, Domenic Denicola
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
notices: []

32
.licenses/npm/whatwg-url.dep.yml generated Normal file
View File

@ -0,0 +1,32 @@
---
name: whatwg-url
version: 5.0.0
type: npm
summary: An implementation of the WHATWG URL Standard's URL API and parsing machinery
homepage:
license: mit
licenses:
- sources: LICENSE.txt
text: |
The MIT License (MIT)
Copyright (c) 20152016 Sebastian Mayr
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
notices: []

76
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at opensource+actions/setup-dotnet@github.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

213
README.md
View File

@ -1,92 +1,126 @@
# setup-dotnet
<p align="left">
<a href="https://github.com/actions/setup-dotnet"><img alt="GitHub Actions status" src="https://github.com/actions/setup-dotnet/workflows/Main%20workflow/badge.svg"></a>
</p>
[![GitHub Actions Status](https://github.com/actions/setup-dotnet/workflows/Main%20workflow/badge.svg)](https://github.com/actions/setup-dotnet)
This action sets up a [dotnet core cli](https://github.com/dotnet/cli) environment for use in actions by:
This action sets up a [.NET CLI](https://github.com/dotnet/sdk) environment for use in actions by:
- optionally downloading and caching a version of dotnet by SDK version and adding to PATH
- optionally downloading and caching a version(s) of dotnet by SDK version(s) and adding to PATH
- registering problem matchers for error output
- setting up authentication to private package sources like GitHub Packages
Please Note: GitHub hosted runners have some versions of the .NET SDK
> **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
## Usage
See [action.yml](action.yml)
Basic:
**Basic**:
```yaml
steps:
- uses: actions/checkout@main
- uses: actions/setup-dotnet@v1
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel
dotnet-version: '3.1.x'
- run: dotnet build <my project>
```
Matrix Testing:
```yaml
**Multiple version installation**:
```yml
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
- run: dotnet build <my project>
```
> **Note**: In case multiple versions are installed, the latest .NET version will be used by default unless another version is specified in the `global.json` file.
## Supported version syntax
The `dotnet-version` input supports following syntax:
- **A.B.C** (e.g 6.0.400, 7.0.100-preview.7.22377.5) - installs exact version of .NET SDK
- **A.B** or **A.B.x** (e.g. 3.1, 3.1.x) - installs the latest patch version of .NET SDK on the channel `3.1`, including prerelease versions (preview, rc)
- **A** or **A.x** (e.g. 3, 3.x) - installs the latest minor version of the specified major tag, including prerelease versions (preview, rc)
## Using the `dotnet-quality` input
This input sets up the action to install the latest build of the specified quality in the channel. The possible values of `dotnet-quality` are: **daily**, **signed**, **validated**, **preview**, **ga**.
> **Note**: `dotnet-quality` input can be used only with .NET SDK version in 'A.B', 'A.B.x', 'A' and 'A.x' formats where the major version is higher than 5. In other cases, `dotnet-quality` input will be ignored.
```yml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-quality: 'preview'
- run: dotnet build <my project>
```
## Using the `global-json-file` input
`setup-dotnet` action can read .NET SDK version from a `global.json` file. Input `global-json-file` is used for specifying the path to the `global.json`. If the file that was supplied to `global-json-file` input doesn't exist, the action will fail with error.
>**Note**: In case both `dotnet-version` and `global-json-file` inputs are used, versions from both inputs will be installed.
```yml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
global-json-file: csharp/global.json
- run: dotnet build <my project>
working-directory: csharp
```
## Matrix Testing
Using `setup-dotnet` it's possible to use [matrix syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) to install several versions of .NET SDK:
```yml
jobs:
build:
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
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet }}
- run: dotnet build <my project>
```
## Setting up authentication for nuget feeds
Side by Side Testing:
```yaml
jobs:
build:
runs-on: ubuntu-latest
name: Dotnet Side by Side testing sample
steps:
- uses: actions/checkout@v2
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.2.103'
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- run: dotnet build <my project>
- run: dotnet test <my project>
```
Authentication for nuget feeds:
```yaml
### Github Package Registry (GPR)
```yml
steps:
- uses: actions/checkout@v2
# Authenticates packages to push to GPR
- uses: actions/setup-dotnet@v1
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x' # SDK Version to use.
dotnet-version: '3.1.x'
source-url: https://nuget.pkg.github.com/<owner>/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- run: dotnet build <my project>
- name: Create the package
run: dotnet pack --configuration Release <my project>
- name: Publish the package to GPR
- name: Publish the package to GPR
run: dotnet nuget push <my project>/bin/Release/*.nupkg
```
# Authticates packages to push to Azure Artifacts
- uses: actions/setup-dotnet@v1
### Azure Artifacts
```yml
- uses: actions/setup-dotnet@v3
with:
source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json
env:
@ -95,31 +129,94 @@ steps:
run: dotnet nuget push <my project>/bin/Release/*.nupkg
```
## Environment Variables to use with dotnet
### nuget.org
```yml
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x
- name: Publish the package to nuget.org
run: dotnet nuget push */bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
```
> **Note**: It's the only way to push a package to nuget.org feed for macOS/Linux machines due to API key config store limitations.
Some environment variables may be necessary for your particular case or to improve logging. Some examples are listed below, but the full list with complete details can be found here: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet#environment-variables
# Outputs and environment variables
- DOTNET_NOLOGO - removes logo and telemetry message from first run of dotnet cli (default: false)
- DOTNET_CLI_TELEMETRY_OPTOUT - opt-out of telemetry being sent to Microsoft (default: false)
- DOTNET_MULTILEVEL_LOOKUP - configures whether the global install location is used as a fall-back (default: true)
## Outputs
### `dotnet-version`
Using the **dotnet-version** output it's possible to get the installed by the action .NET SDK version.
**Single version installation**
In case of a single version installation, the `dotnet-version` output contains the version that is installed by the action.
Example usage:
```yaml
- uses: actions/setup-dotnet@v3
id: cp310
with:
dotnet-version: 3.1.422
- run: echo '${{ steps.cp310.outputs.dotnet-version }}' # outputs 3.1.422
```
**Multiple version installation**
In case of a multiple version installation, the `dotnet-version` output contains the latest version that is installed by the action.
```yaml
- uses: actions/setup-dotnet@v3
id: cp310
with:
dotnet-version: |
3.1.422
5.0.408
- run: echo '${{ steps.cp310.outputs.dotnet-version }}' # outputs 5.0.408
```
**Installation from global.json**
When the `dotnet-version` input is used along with the `global-json-file` input, the `dotnet-version` output contains the version resolved from the `global.json`.
```yaml
- uses: actions/setup-dotnet@v3
id: cp310
with:
dotnet-version: |
3.1.422
5.0.408
global-json-file: "./global.json" # contains version 2.2.207
- run: echo '${{ steps.cp310.outputs.dotnet-version }}' # outputs 2.2.207
```
## Environment variables
Some environment variables may be necessary for your particular case or to improve logging. Some examples are listed below, but the full list with complete details can be found here: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables
| **Env.variable** | **Description** | **Default value** |
| ----------- | ----------- | ----------- |
| DOTNET_INSTALL_DIR |Specifies a directory where .NET SDKs should be installed by the action|*isn't set*|
| DOTNET_NOLOGO |Removes logo and telemetry message from first run of dotnet cli|*false*|
| DOTNET_CLI_TELEMETRY_OPTOUT |Opt-out of telemetry being sent to Microsoft|*false*|
| DOTNET_MULTILEVEL_LOOKUP |Configures whether the global install location is used as a fall-back|*true*|
**Example usage**:
```yml
build:
runs-on: ubuntu-latest
env:
DOTNET_NOLOGO: true
DOTNET_INSTALL_DIR: "path/to/directory"
steps:
- uses: actions/checkout@main
- uses: actions/setup-dotnet@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.100' # SDK Version to use.
dotnet-version: '3.1.x'
```
# License
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
# Contributions
## Contributions
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)

View File

@ -1,6 +1,6 @@
import io = require('@actions/io');
import fs = require('fs');
import path = require('path');
import * as io from '@actions/io';
import fs from 'fs';
import path from 'path';
const fakeSourcesDirForTesting = path.join(
__dirname,

View File

@ -0,0 +1,13 @@
$dotnetPaths = @{
Linux = "/usr/share/dotnet"
macOS = "$env:HOME/.dotnet"
Windows = "$env:ProgramFiles\dotnet", "$env:LocalAppData\Microsoft\dotnet"
}
foreach ($srcPath in $dotnetPaths[$args[0]]) {
if (Test-Path $srcPath) {
Write-Host "Move $srcPath path"
$dstPath = Join-Path ([IO.Path]::GetTempPath()) ([IO.Path]::GetRandomFileName())
Move-Item -Path $srcPath -Destination $dstPath
}
}

View File

@ -1,5 +1,3 @@
import fs = require('fs');
describe('csc tests', () => {
it('Valid regular expression', async () => {
var cscFile = require('../.github/csc.json');

View File

@ -1,37 +1,79 @@
import io = require('@actions/io');
import fs = require('fs');
import os = require('os');
import path = require('path');
import hc = require('@actions/http-client');
import * as io from '@actions/io';
import * as os from 'os';
import fs from 'fs';
import path from 'path';
import each from 'jest-each';
import * as hc from '@actions/http-client';
import * as installer from '../src/installer';
import {QualityOptions} from '../src/setup-dotnet';
const toolDir = path.join(__dirname, 'runner', 'tools');
import {IS_WINDOWS} from '../src/utils';
import {IS_LINUX} from '../src/utils';
let toolDir: string;
if (IS_WINDOWS) {
toolDir = path.join(process.env['PROGRAMFILES'] + '', 'dotnet');
} else if (IS_LINUX) {
toolDir = '/usr/share/dotnet';
} else {
toolDir = path.join(process.env['HOME'] + '', '.dotnet');
}
const tempDir = path.join(__dirname, 'runner', 'temp');
process.env['RUNNER_TOOL_CACHE'] = toolDir;
process.env['RUNNER_TEMP'] = tempDir;
import * as installer from '../src/installer';
const IS_WINDOWS = process.platform === 'win32';
describe('installer tests', () => {
describe('DotnetCoreInstaller tests', () => {
beforeAll(async () => {
process.env.RUNNER_TOOL_CACHE = toolDir;
process.env.DOTNET_INSTALL_DIR = toolDir;
process.env.RUNNER_TEMP = tempDir;
process.env.DOTNET_ROOT = '';
await io.rmRF(toolDir);
await io.rmRF(tempDir);
});
afterAll(async () => {
try {
await io.rmRF(toolDir);
await io.rmRF(tempDir);
} catch {
console.log('Failed to remove test directories');
await io.rmRF(`${toolDir}/*`);
await io.rmRF(`${tempDir}/*`);
} catch (err) {
console.log(
`Failed to remove test directories, check the error message:${os.EOL}`,
err.message
);
}
}, 30000);
afterEach(async () => {
try {
await io.rmRF(`${toolDir}/*`);
await io.rmRF(`${tempDir}/*`);
} catch (err) {
console.log(
`Failed to remove test directories, check the error message:${os.EOL}`,
err.message
);
}
}, 30000);
it('Aquires multiple versions of dotnet', async () => {
const versions = ['2.2.207', '3.1.120'];
for (const version of versions) {
await getDotnet(version);
}
expect(fs.existsSync(path.join(toolDir, 'sdk', '2.2.207'))).toBe(true);
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.120'))).toBe(true);
if (IS_WINDOWS) {
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
} else {
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
}
expect(process.env.DOTNET_ROOT).toBeDefined;
expect(process.env.PATH).toBeDefined;
expect(process.env.DOTNET_ROOT).toBe(toolDir);
expect(process.env.PATH?.startsWith(toolDir)).toBe(true);
}, 600000);
it('Acquires version of dotnet if no matching version is installed', async () => {
await getDotnet('3.1.201');
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true);
@ -65,14 +107,19 @@ describe('installer tests', () => {
expect(process.env.PATH?.startsWith(toolDir)).toBe(true);
}, 600000); //This needs some time to download on "slower" internet connections
it('Returns string with installed SDK version', async () => {
const version = '3.1.120';
let installedVersion: string;
installedVersion = await getDotnet(version);
expect(installedVersion).toBe('3.1.120');
}, 600000);
it('Throws if no location contains correct dotnet version', async () => {
let thrown = false;
try {
await expect(async () => {
await getDotnet('1000.0.0');
} catch {
thrown = true;
}
expect(thrown).toBe(true);
}).rejects.toThrow();
}, 30000);
it('Uses an up to date bash download script', async () => {
@ -116,6 +163,112 @@ describe('installer tests', () => {
}, 30000);
});
describe('DotnetVersionResolver tests', () => {
each([
'3.1',
'3.x',
'3.1.x',
'3.1.*',
'3.1.X',
'3.1.2',
'3.1.0-preview1'
]).test(
"if valid version: '%s' is supplied, it should return version object with some value",
async version => {
const dotnetVersionResolver = new installer.DotnetVersionResolver(
version
);
const versionObject = await dotnetVersionResolver.createDotNetVersion();
expect(!!versionObject.value).toBeTruthy;
}
);
each([
'.',
'..',
' . ',
'. ',
' .',
' . . ',
' .. ',
' . ',
'-1.-1',
'-1',
'-1.-1.-1',
'..3',
'1..3',
'1..',
'.2.3',
'.2.x',
'*.',
'1.2.',
'1.2.-abc',
'a.b',
'a.b.c',
'a.b.c-preview',
' 0 . 1 . 2 ',
'invalid'
]).test(
"if invalid version: '%s' is supplied, it should throw",
async version => {
const dotnetVersionResolver = new installer.DotnetVersionResolver(
version
);
await expect(
async () => await dotnetVersionResolver.createDotNetVersion()
).rejects.toThrow();
}
);
each(['3.1', '3.1.x', '3.1.*', '3.1.X']).test(
"if version: '%s' that can be resolved to 'channel' option is supplied, it should set quality flag to 'true' and type to 'channel' in version object",
async version => {
const dotnetVersionResolver = new installer.DotnetVersionResolver(
version
);
const versionObject = await dotnetVersionResolver.createDotNetVersion();
expect(versionObject.type.toLowerCase().includes('channel')).toBeTruthy;
expect(versionObject.qualityFlag).toBeTruthy;
}
);
each(['3.1.2', '3.1.0-preview1']).test(
"if version: '%s' that can be resolved to 'version' option is supplied, it should set quality flag to 'false' and type to 'version' in version object",
async version => {
const dotnetVersionResolver = new installer.DotnetVersionResolver(
version
);
const versionObject = await dotnetVersionResolver.createDotNetVersion();
expect(versionObject.type.toLowerCase().includes('version')).toBeTruthy;
expect(versionObject.qualityFlag).toBeFalsy;
}
);
each(['3.1.2', '3.1']).test(
'it should create proper line arguments for powershell/bash installation scripts',
async version => {
const dotnetVersionResolver = new installer.DotnetVersionResolver(
version
);
const versionObject = await dotnetVersionResolver.createDotNetVersion();
const windowsRegEx = new RegExp(/^-[VC]/);
const nonWindowsRegEx = new RegExp(/^--[vc]/);
if (IS_WINDOWS) {
expect(windowsRegEx.test(versionObject.type)).toBeTruthy;
expect(nonWindowsRegEx.test(versionObject.type)).toBeFalsy;
} else {
expect(nonWindowsRegEx.test(versionObject.type)).toBeTruthy;
expect(windowsRegEx.test(versionObject.type)).toBeFalsy;
}
}
);
});
function normalizeFileContents(contents: string): string {
return contents
.trim()
@ -123,7 +276,15 @@ function normalizeFileContents(contents: string): string {
.replace(new RegExp('\r', 'g'), '\n');
}
async function getDotnet(version: string): Promise<void> {
const dotnetInstaller = new installer.DotnetCoreInstaller(version);
await dotnetInstaller.installDotnet();
async function getDotnet(
version: string,
quality: string = ''
): Promise<string> {
const dotnetInstaller = new installer.DotnetCoreInstaller(
version,
quality as QualityOptions
);
const installedVersion = await dotnetInstaller.installDotnet();
installer.DotnetCoreInstaller.addToPath();
return installedVersion;
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;netcoreapp3.0;netcoreapp2.2</TargetFrameworks>
<RootNamespace>sample_csproj</RootNamespace>
<IsPackable>false</IsPackable>

View File

@ -1,30 +1,52 @@
import io = require('@actions/io');
import fs = require('fs');
import os = require('os');
import path = require('path');
const toolDir = path.join(__dirname, 'runner', 'tools2');
const tempDir = path.join(__dirname, 'runner', 'temp2');
import * as io from '@actions/io';
import * as core from '@actions/core';
import fs from 'fs';
import os from 'os';
import path from 'path';
import * as setup from '../src/setup-dotnet';
import {IS_WINDOWS} from '../src/utils';
import {IS_LINUX} from '../src/utils';
const IS_WINDOWS = process.platform === 'win32';
let toolDir: string;
if (IS_WINDOWS) {
toolDir = path.join(process.env['PROGRAMFILES'] + '', 'dotnet');
} else if (IS_LINUX) {
toolDir = '/usr/share/dotnet';
} else {
toolDir = path.join(process.env['HOME'] + '', '.dotnet');
}
const tempDir = path.join(__dirname, 'runner', 'temp2');
describe('setup-dotnet tests', () => {
let getInputSpy = jest.spyOn(core, 'getInput');
let getMultilineInputSpy = jest.spyOn(core, 'getMultilineInput');
let setOutputSpy = jest.spyOn(core, 'setOutput');
let inputs = {} as any;
beforeAll(async () => {
process.env.RUNNER_TOOL_CACHE = toolDir;
process.env.DOTNET_INSTALL_DIR = toolDir;
process.env.RUNNER_TEMP = tempDir;
await io.rmRF(toolDir);
await io.rmRF(tempDir);
});
try {
await io.rmRF(`${toolDir}/*`);
await io.rmRF(`${tempDir}/*`);
} catch (err) {
console.log(err.message);
console.log('Failed to remove test directories');
}
}, 30000);
afterAll(async () => {
afterEach(async () => {
try {
await io.rmRF(path.join(process.cwd(), 'global.json'));
await io.rmRF(toolDir);
await io.rmRF(tempDir);
} catch {
await io.rmRF(`${toolDir}/*`);
await io.rmRF(`${tempDir}/*`);
} catch (err) {
console.log(err.message);
console.log('Failed to remove test directories');
}
}, 30000);
@ -44,4 +66,33 @@ describe('setup-dotnet tests', () => {
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
}
}, 400000);
it("Sets output with the latest installed by action version if global.json file isn't specified", async () => {
inputs['dotnet-version'] = ['3.1.201', '6.0.401'];
getMultilineInputSpy.mockImplementation(input => inputs[input]);
await setup.run();
expect(setOutputSpy).toBeCalledWith('dotnet-version', '6.0.401');
}, 400000);
it("Sets output with the version specified in global.json, if it's present", async () => {
const globalJsonPath = path.join(process.cwd(), 'global.json');
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version": "3.0.103"${os.EOL}}${os.EOL}}`;
if (!fs.existsSync(globalJsonPath)) {
fs.writeFileSync(globalJsonPath, jsonContents);
}
inputs['dotnet-version'] = ['3.1.201', '6.0.401'];
inputs['global-json-file'] = './global.json';
getMultilineInputSpy.mockImplementation(input => inputs[input]);
getInputSpy.mockImplementation(input => inputs[input]);
await setup.run();
expect(setOutputSpy).toBeCalledWith('dotnet-version', '3.0.103');
}, 400000);
});

View File

@ -3,30 +3,38 @@ if (!$args[0])
throw "Must supply dotnet version argument"
}
if (-Not (Test-Path "../nuget.config"))
{
throw "nuget file not generated correctly"
}
$dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path }
Write-Host "Found '$dotnet'"
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
Write-Host "Version $version"
if ($version -ne $args[0])
if($args.count -eq 1)
{
Write-Host "PATH='$env:path'"
throw "Unexpected version"
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
Write-Host "Version $version"
if (-not ($version.StartsWith($args[0].ToString())))
{
Write-Host "PATH='$env:PATH'"
throw "Unexpected version"
}
}
if ($args[1])
{
# SDKs are listed on multiple lines with the path afterwards in square brackets
$version = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
Write-Host "Version $version"
if (-not ($version -contains $args[1]))
$versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
Write-Host "Installed versions: $versions"
$InstalledVersionCount = 0
foreach($arg in $args){
foreach ($version in $versions)
{
if ($version.StartsWith($arg.ToString()))
{
$InstalledVersionCount++
}
}
}
if ( $InstalledVersionCount -ne $args.Count)
{
Write-Host "PATH='$env:path'"
Write-Host "PATH='$env:PATH'"
throw "Unexpected version"
}
}
@ -49,6 +57,13 @@ if ($args[1])
throw "Unexpected output"
}
}
if ($args[2])
{
if ($sample_output -notlike "*Test Run Successful.*Test Run Successful.*Test Run Successful.*")
{
throw "Unexpected output"
}
}
else
{
if ($sample_output -notlike "*Test Run Successful.*")

View File

@ -1,17 +1,7 @@
#!/bin/bash
if [[ "$(git status --porcelain)" != "" ]]; then
echo ----------------------------------------
echo git status
echo ----------------------------------------
git status
echo ----------------------------------------
echo git diff
echo ----------------------------------------
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
echo ----------------------------------------
echo Troubleshooting
echo ----------------------------------------
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && npm ci && npm run pre-checkin"
exit 1
fi

View File

@ -1,90 +0,0 @@
import each from 'jest-each';
import * as installer from '../src/installer';
describe('version tests', () => {
each(['3.1.999', '3.1.101-preview.3']).test(
"Exact version '%s' should be the same",
vers => {
let versInfo = new installer.DotNetVersionInfo(vers);
expect(versInfo.isExactVersion()).toBe(true);
expect(versInfo.version()).toBe(vers);
}
);
each([
['3.1.x', '3.1'],
['1.1.*', '1.1'],
['2.0', '2.0']
]).test("Generic version '%s' should be '%s'", (vers, resVers) => {
let versInfo = new installer.DotNetVersionInfo(vers);
expect(versInfo.isExactVersion()).toBe(false);
expect(versInfo.version()).toBe(resVers);
});
each([
'',
'.',
'..',
' . ',
'. ',
' .',
' . . ',
' .. ',
' . ',
'-1.-1',
'-1',
'-1.-1.-1',
'..3',
'1..3',
'1..',
'.2.3',
'.2.x',
'1',
'2.x',
'*.*.1',
'*.1',
'*.',
'1.2.',
'1.2.-abc',
'a.b',
'a.b.c',
'a.b.c-preview',
' 0 . 1 . 2 '
]).test("Malformed version '%s' should throw", vers => {
expect(() => new installer.DotNetVersionInfo(vers)).toThrow();
});
each([
['3.1.x', '3.1.'],
['3.1.*', '3.1.'],
['3.1', '3.1.'],
['5.0.0-preview.6', '5.0.0-preview.6'],
['3.1.201', '3.1.201']
]).test(
"Resolving version '%s' as '%s'",
async (input, expectedVersion) => {
const dotnetInstaller = new installer.DotnetCoreInstaller(input);
let versInfo = await dotnetInstaller.resolveVersion(
new installer.DotNetVersionInfo(input)
);
console.log(versInfo);
expect(versInfo.startsWith(expectedVersion));
},
100000
);
it('Resolving a nonexistent generic version fails', async () => {
const dotnetInstaller = new installer.DotnetCoreInstaller('999.1.x');
try {
await dotnetInstaller.resolveVersion(
new installer.DotNetVersionInfo('999.1.x')
);
fail();
} catch {
expect(true);
}
}, 100000);
});

View File

@ -1,18 +1,25 @@
name: 'Setup .NET Core SDK'
description: 'Set up a specific version of the .NET Core CLI in the PATH and set up authentication to a private NuGet repository'
description: 'Used to build and publish .NET source. Set up a specific version of the .NET and authentication to private NuGet repository'
author: 'GitHub'
branding:
icon: play
color: green
inputs:
dotnet-version:
description: 'SDK version to use. Examples: 2.2.104, 3.1, 3.1.x'
description: 'Optional SDK version(s) to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x, 3.x'
dotnet-quality:
description: 'Optional quality of the build. The possible values are: daily, signed, validated, preview, ga.'
global-json-file:
description: 'Optional global.json location, if your global.json isn''t located in the root of the repo.'
source-url:
description: 'Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword'
owner:
description: 'Optional OWNER for using packages from GitHub Package Registry organizations/users other than the current repository''s owner. Only used if a GPR URL is also provided in source-url'
config-file:
description: 'Optional NuGet.config location, if your NuGet.config isn''t located in the root of the repo.'
outputs:
dotnet-version:
description: 'Contains the installed by action .NET SDK version for reuse.'
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'

33598
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,57 @@
# v3 setup-dotnet
Date: 2022-08-25
Status: Accepted
# Context
- GitHub-hosted Ubuntu and Windows runners have .NET versions pre-installed in system directories
- Ubuntu:`/usr/share/dotnet`
- Windows:`C:\Program Files\dotnet`
- V1 version of Action installs .NET to the user's directory
- Ubuntu:`/home/runner/.dotnet`
- Windows: `C:\Users\runneradmin\AppData\Local\Microsoft\dotnet`
- It means that action always downloads and installs .NET version even if it is pre-installed. Also after using the action all pre-installed .NET versions are unavailable because `DOTNET_ROOT` is overridden to the user's directory.
The behavior is different for macOS runners because the pre-installation directory matches the one that is used by action. It means action can use pre-installed versions if they exist, which speeds up the customer's workflow.
- The different behavior of the setup task on Ubuntu, Windows and macOS runners is unclear and confusing for customers.
- .NET supports installing and using multiple versions of .NET SDK and .NET runtime side-by-side. .NET CLI will use the latest installed .NET SDK and .NET runtime versions if there is no global.json file containing a different version. This behavior is defined by .NET design (https://docs.microsoft.com/en-us/dotnet/core/versions/selection).
- The action contains logic to handle inputs with wildcards, for example `5.0.x`, `5.0.*`, `5.x` or `5.*`. This logic uses metadata from `https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json` to retrieve the list of available releases and get the latest release version for the specified major and/or minor version from the input. After that, installer script (`dotnet-install.ps1` for Windows or `dotnet-install.sh` for Linux and macOS) installs the required SDK using exact version as a parameter.
# Proposal
- Change .NET installation path for Windows and Ubuntu images to match the location of pre-installed versions by using `-InstallDir` (Windows) and `--install-dir` (Ubuntu) properties for installer scripts:
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
- Simplify and in some cases fully get rid of logic for resolving wildcard versions and start relying on [official installer scripts provided by .NET Core team](https://github.com/dotnet/install-scripts).
The execution `dotnet-install.ps1 -Channel 5.0` installs the latest patch version for 5.0 SDK. If SDK is in the prerelease phase, the latest prerelease version (preview or rc) will be installed.
Inputs with wildcards in the patch tag (`5.0.x` or `5.0.*`) can be handled by passing major and minor versions to the installer script directly as a `channel` parameter. This parameter supports two-part version in `X.Y` format as input value ([see installer scripts documentation](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script)).
Inputs with wildcards in the minor tag (`3.x` or `3.*`) can be handled like that:
1. The request is sent to MS dist and the `releases.json` file is got
2. The action gets the latest possible channel version out of retrieved `releases.json` that satisfies input major tag (e.g. for `3.x` nowadays it's `3.1`)
3. Retrieved channel version is passed to installer script directly as `channel` parameter.
> **Note:** Using the `channel` parameter of the MS .NET installer scripts will allow us to use the `quality` parameter as well. This functionality is also asked for by our customers.
# Breaking changes
- The presence of pre-installed .NET versions that are higher than the version that the users specify in the setup task can be breaking for some customers, who expect only one installed .NET version on the runner after using the setup task. If a user doesn't have .NET version specified in project file, the `dotnet` will use the latest installed version instead of provided in the setup task.
> **Note:** It is the biggest deal in this ADR.
Previously, when a user would specify a .NET version, this exact version was used by the `dotnet` command by default (because it was installed in a separate folder and there were no other.NET versions in that folder)
In the proposal, the specified version will be installed on the machine but the latest version will be used by the `dotnet` command by default (because specified version will be installed alongside with pre-installed .NET versions).
Based on [official .NET documentation](https://docs.microsoft.com/en-us/dotnet/core/versions/selection), it is expected behavior and how it works on user's local machine with multiple installed .NET versions but some customer's workflows could be broken because they already rely on current behavior.
To avoid breaking customers, we will need to release a new major task version (v3).
# v3-preview
There will be a v3-preview branch that will be created for development and testing. Any changes will first be merged into the v3-preview branch. After a period of testing & verification, the v3-preview branch will be merged into the main branch and a v3 tag will be created. Any GitHub public documentation and starter workflows that mention setup-dotnet will then be updated to use v3 instead of v2:
- [README.md](https://github.com/actions/setup-dotnet/blob/main/README.md)
- [action.yml](https://github.com/actions/setup-dotnet/blob/main/action.yml)
- [GitHub docs](https://docs.github.com/en/actions/guides/building-and-testing-net#using-a-specific-net-version)
- Starter-workflow yamls: [#1](https://github.com/actions/starter-workflows/blob/main/ci/dotnet.yml#L17), [#2](https://github.com/actions/starter-workflows/blob/main/ci/dotnet-desktop.yml#L72)
# Consequences
- Customers will be able to use pre-installed .NET versions with setup-dotnet action on Windows and Ubuntu

View File

@ -1,24 +1,113 @@
# Contributors
Thank you for contributing! This action is targetted around setting up the dotnet cli and related sdks for GitHub actions. As part of that we use proxy settings (for self-hosted runners) and set-up nuget authentication for private feeds.
Thank you for contributing!
If you would like to contribute there are a few things to consider:
We have prepared a short guide so that the process of making your contribution is as simple and clear as possible. Please check it out before you contribute!
## Commands to use
## How can I contribute...
- npm run build - Compiles the action into a single js file at dist/index.js (Please check in the changes made by this command)
- npm run test - Runs all tests under __tests__
- npm run format - Runs formatting required to pass the lint test (Please check in the changes made by this command)
- npm run update-installers - Updates the install-dotnet scripts in externals (Please check in the changes made by this command)
* [Contribute Documentation:green_book:](#contribute-documentation)
## To check in or not to check in
* [Contribute Code :computer:](#contribute-code)
- Do check in source (src)
- Do check in index file (dist)
- Do check in updates to install-dotnet scripts (externals)
- Do not check in build output (lib)
- Do not check in runtime (node_modules)
* [Provide Support on Issues:pencil:](#provide-support-on-issues)
## Writing tests
* [Review Pull Requests:mag:](#review-pull-requests)
With any contribution please take time to consider how this can be tested to maintain high quality. Current tests can be found in the folder __tests__ for examples.
## Contribute documentation
Documentation is a super important, critical part of this project. Docs are how we keep track of what we're doing, how, and why. It's how we stay on the same page about our policies and how we tell others everything they need to be able to use this project or contribute to it.
Documentation contributions of any size are welcome! Feel free to contribute even if you're just rewording a sentence to be more clear, or fixing a spelling mistake!
**How to contribute:**
Pull requests are the easiest way to contribute changes to git repos at GitHub. They are the preferred contribution method, as they offer a convenient way of commenting and amending the proposed changes.
- Please check that no one else has already created a pull request with these or similar changes
- Use a "feature branch" for your changes. That separates the changes in the pull request from your other changes and makes it easy to edit/amend commits in the pull request
- Make sure your changes are formatted properly and consistently with the rest of the documentation
- Re-read what you wrote, and run a spellchecker on it to make sure you didn't miss anything
- If your pull request is connected to an open issue, please, leave a link to this issue in the `Related issue:` section
- If you later need to add new commits to the pull request, you can simply commit the changes to the local branch and then push them. The pull request gets automatically updated
**Once you've filed the pull request:**
- Maintainers will review your pull request
- If a maintainer requests changes, first of all, try to think about this request critically and only after that implement and request another review
- If your PR gets accepted, it will soon be merged into the main branch. But your contribution will take effect only after the release of a new version of the action and updating the major tag
> Sometimes maintainers reject pull requests and that's ok! Usually, along with rejection, we supply the reason for it. Nonetheless, we still really appreciate you taking the time to do it, and we don't take that lightly :heart:
## Contribute code
We like code commits a lot! They're super handy, and they keep the project going and doing the work it needs to do to be useful to others.
Code contributions of just about any size are acceptable!
The main difference between code contributions and documentation contributions is that contributing code requires the inclusion of relevant tests for the code being added or changed. Contributions without accompanying tests will be held off until a test is added unless the maintainers consider the specific tests to be either impossible or way too much of a burden for such a contribution.
**How to contribute:**
Pull requests are the easiest way to contribute changes to git repos at GitHub. They are the preferred contribution method, as they offer a convenient way of commenting and amending the proposed changes.
- Please check that no one else has already created a pull request with these or similar changes
- Use a "feature branch" for your changes. That separates the changes in the pull request from your other changes and makes it easy to edit/amend commits in the pull request
- Format, build and test changes
- Make sure your changes are well formatted and that all tests are passing
- If your pull request is connected to an open issue, please, leave a link to this issue in the `Related issue:` section
- If you later need to add new commits to the pull request, you can simply commit the changes to the local branch and then push them. The pull request gets automatically updated
**Learn more about how to work with the repository:**
- To implement new features or fix bugs, you need to make changes to the `.ts` files, which are located in the `src` folder
- To comply with the code style, **you need to run the `format` script**
- To transpile source code to `javascript` we use [NCC](https://github.com/vercel/ncc). **It is very important to run the `build` script after making changes**, otherwise your changes will not get into the final `javascript` build
**Learn more about how to implement tests:**
Adding or changing tests is an integral part of making a change to the code.
Unit tests are in the `__tests__` folder, and end-to-end tests are in the `workflows` folder, particularly in the [workflow.yml](https://github.com/actions/setup-dotnet/blob/main/.github/workflows/workflow.yml).
- The contributor can add various types of tests (like unit tests or end-to-end tests), which, in his opinion, will be necessary and sufficient for testing new or changed functionality
- Tests should cover a successful execution, as well as some edge cases and possible errors
- As already mentioned, pull requests without tests will be considered more carefully by maintainers. If you are sure that in this situation the tests are not needed or cannot be implemented with a commensurate effort - please add this clarification message to your pull request
**Once you've filed the pull request:**
- CI will start automatically with some checks. Wait until the end of the execution and make sure that all checks passed successfully. If some checks fail, you can open them one by one, try to find the reason for failing and make changes to your code to resolve the problem
> Sometimes you may need to update the installers you can do this with the `npm run update-installers` command
- Maintainers will review your pull request
- If a maintainer requests changes, first of all, try to think about his request critically and only after that implement and request another review
- If your PR gets accepted, it will soon be merged into the main branch. But your contribution will take effect only after the release of a new version of the action and updating the major tag
> Sometimes maintainers reject pull requests and that's ok! Usually, along with rejection, we supply the reason for it. Nonetheless, we still really appreciate you taking the time to do it, and we don't take that lightly :heart:
## Provide support on issues
Helping out other users with their questions is an awesome way of contributing to any community. It's not uncommon for most of the issues on open source projects to be support-related questions by users trying to understand something they ran into or find their way around a known bug.
**To help other folks out with their questions:**
- Go to the [issue tracker](https://github.com/actions/setup-dotnet/issues)
- Read through the list until you find something that you're familiar enough with to answer to
- Respond to the issue with whatever details are needed to clarify the question, or get more details about what's going on
- Once the discussion wraps up and things are clarified, ask the original issue filer (or a maintainer) to close it for you
*Some notes on picking up support issues:*
- Avoid responding to issues you don't know you can answer accurately
- Try to refer to past issues with accepted answers as much as possible. Link to them from your replies
- Be kind and patient with users. Often, folks who have run into confusing things might be upset or impatient. This is natural. If you feel uncomfortable in conversation with them, it's better to stay away or withdraw from the issue.
> If some user is violating our code of conduct [standards](https://github.com/actions/setup-dotnet/blob/main/CODE_OF_CONDUCT.md#our-standards), refer to the [Enforcement](https://github.com/actions/setup-dotnet/blob/main/CODE_OF_CONDUCT.md#enforcement) section of the Code of Conduct to resolve the conflict
## Review pull requests
Another great way to contribute is to review pull request. Please, be extra kind: people who submit code/doc contributions are putting themselves in a pretty vulnerable position, and have put time and care into what they've done (even if that's not obvious to you!) Please, always respond with respect, and be understanding, but don't feel like you need to sacrifice your standards for their sake, either.
**How to review:**
- Go to the [pull requests](https://github.com/actions/setup-dotnet/pulls)
- Make sure you're familiar with the code or documentation is updated, unless it's a minor change (spellchecking, minor formatting, etc.)
- Review changes using the GitHub functionality. You can ask a clarifying question, point out an error or suggest an alternative.
> Note: You may ask for minor changes - "nitpicks", but consider whether they are real blockers to merging or not
- Submit your review, which may include comments, an approval, or a changes request

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

8774
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "setup-dotnet",
"version": "1.0.0",
"version": "3.0.1",
"private": true,
"description": "setup dotnet action",
"main": "lib/setup-dotnet.js",
@ -8,16 +8,10 @@
"build": "tsc && ncc build",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"test": "jest",
"prepare": "husky install",
"test": "jest --coverage --config ./jest.config.js",
"update-installers": "nwget https://dot.net/v1/dotnet-install.ps1 -O externals/install-dotnet.ps1 && nwget https://dot.net/v1/dotnet-install.sh -O externals/install-dotnet.sh"
},
"husky": {
"hooks": {
"//": "Tests are not run at push time since they can take 2-4 minutes to complete",
"pre-commit": "npm run format",
"pre-push": "npm run format-check"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions/setup-dotnet.git"
@ -30,25 +24,25 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.5",
"@actions/core": "^1.9.1",
"@actions/exec": "^1.0.4",
"@actions/github": "^1.1.0",
"@actions/http-client": "^1.0.8",
"@actions/http-client": "^2.0.1",
"@actions/io": "^1.0.2",
"fast-xml-parser": "^3.15.1",
"semver": "^6.3.0",
"xmlbuilder": "^13.0.2"
},
"devDependencies": {
"@types/jest": "^25.2.3",
"@types/node": "^12.12.62",
"@types/jest": "^27.0.2",
"@types/node": "^16.11.25",
"@types/semver": "^6.2.2",
"@zeit/ncc": "^0.21.1",
"husky": "^4.3.0",
"jest": "^26.4.2",
"jest-circus": "^26.4.2",
"@vercel/ncc": "^0.33.4",
"husky": "^8.0.1",
"jest": "^27.2.5",
"jest-circus": "^27.2.5",
"prettier": "^1.19.1",
"ts-jest": "^26.4.0",
"ts-jest": "^27.0.5",
"typescript": "^3.9.7",
"wget-improved": "^3.2.1"
},

View File

@ -4,7 +4,6 @@ import * as core from '@actions/core';
import * as github from '@actions/github';
import * as xmlbuilder from 'xmlbuilder';
import * as xmlParser from 'fast-xml-parser';
import {ProcessEnvOptions} from 'child_process';
export function configAuthentication(
feedUrl: string,
@ -13,7 +12,9 @@ export function configAuthentication(
) {
const existingNuGetConfig: string = path.resolve(
processRoot,
existingFileLocation == '' ? 'nuget.config' : existingFileLocation
existingFileLocation === ''
? getExistingNugetConfig(processRoot)
: existingFileLocation
);
const tempNuGetConfig: string = path.resolve(
@ -25,12 +26,27 @@ export function configAuthentication(
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
}
function isValidKey(key: string): boolean {
return /^[\w\-\.]+$/i.test(key);
}
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(
feedUrl: string,
existingFileLocation: string,
tempFileLocation: string
) {
console.log(
core.info(
`dotnet-auth: Finding any source references in ${existingFileLocation}, writing a new temporary configuration file with credentials to ${tempFileLocation}`
);
let xml: xmlbuilder.XMLElement;
@ -41,7 +57,7 @@ function writeFeedToFile(
owner = github.context.repo.owner;
}
if (!process.env.NUGET_AUTH_TOKEN || process.env.NUGET_AUTH_TOKEN == '') {
if (!process.env.NUGET_AUTH_TOKEN) {
throw new Error(
'The NUGET_AUTH_TOKEN environment variable was not provided. In this step, add the following: \r\nenv:\r\n NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}'
);
@ -50,22 +66,22 @@ function writeFeedToFile(
if (fs.existsSync(existingFileLocation)) {
// get key from existing NuGet.config so NuGet/dotnet can match credentials
const curContents: string = fs.readFileSync(existingFileLocation, 'utf8');
var json = xmlParser.parse(curContents, {ignoreAttributes: false});
const json = xmlParser.parse(curContents, {ignoreAttributes: false});
if (typeof json.configuration == 'undefined') {
if (typeof json.configuration === 'undefined') {
throw new Error(`The provided NuGet.config seems invalid.`);
}
if (typeof json.configuration.packageSources != 'undefined') {
if (typeof json.configuration.packageSources.add != 'undefined') {
// file has at least one <add>
if (typeof json.configuration.packageSources.add[0] == 'undefined') {
if (typeof json.configuration.packageSources.add[0] === 'undefined') {
// file has only one <add>
if (
json.configuration.packageSources.add['@_value']
.toLowerCase()
.includes(feedUrl.toLowerCase())
) {
let key = json.configuration.packageSources.add['@_key'];
const key = json.configuration.packageSources.add['@_key'];
sourceKeys.push(key);
core.debug(`Found a URL with key ${key}`);
}
@ -80,7 +96,7 @@ function writeFeedToFile(
const value = source['@_value'];
core.debug(`source '${value}'`);
if (value.toLowerCase().includes(feedUrl.toLowerCase())) {
let key = source['@_key'];
const key = source['@_key'];
sourceKeys.push(key);
core.debug(`Found a URL with key ${key}`);
}
@ -97,7 +113,7 @@ function writeFeedToFile(
.up()
.up();
if (sourceKeys.length == 0) {
if (!sourceKeys.length) {
let keystring = 'Source';
xml = xml
.ele('packageSources')
@ -109,9 +125,9 @@ function writeFeedToFile(
xml = xml.ele('packageSourceCredentials');
sourceKeys.forEach(key => {
if (key.indexOf(' ') > -1) {
if (!isValidKey(key)) {
throw new Error(
"This action currently can't handle source names with spaces. Remove the space from your repo's NuGet.config and try again."
"Source name can contain letters, numbers, and '-', '_', '.' symbols only. Please, fix source name in NuGet.config and try again."
);
}
@ -133,6 +149,6 @@ function writeFeedToFile(
// ? '%NUGET_AUTH_TOKEN%'
// : '$NUGET_AUTH_TOKEN'
var output = xml.end({pretty: true});
const output = xml.end({pretty: true});
fs.writeFileSync(tempFileLocation, output);
}

View File

@ -2,278 +2,271 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import hc = require('@actions/http-client');
import * as hc from '@actions/http-client';
import {chmodSync} from 'fs';
import * as path from 'path';
import {ExecOptions} from '@actions/exec/lib/interfaces';
import * as semver from 'semver';
import {readdir} from 'fs/promises';
import path from 'path';
import semver from 'semver';
import {IS_LINUX, IS_WINDOWS} from './utils';
import {QualityOptions} from './setup-dotnet';
const IS_WINDOWS = process.platform === 'win32';
export interface DotnetVersion {
type: string;
value: string;
qualityFlag: boolean;
}
/**
* Represents the inputted version information
*/
export class DotNetVersionInfo {
public inputVersion: string;
private fullversion: string;
private isExactVersionSet: boolean = false;
export class DotnetVersionResolver {
private inputVersion: string;
private resolvedArgument: DotnetVersion;
constructor(version: string) {
this.inputVersion = version;
// Check for exact match
if (semver.valid(semver.clean(version) || '') != null) {
this.fullversion = semver.clean(version) as string;
this.isExactVersionSet = true;
return;
}
//Note: No support for previews when using generic
let parts: string[] = 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 = this.getVersionNumberOrThrow(parts[1]);
this.fullversion = major + '.' + minor;
this.inputVersion = version.trim();
this.resolvedArgument = {type: '', value: '', qualityFlag: false};
}
private getVersionNumberOrThrow(input: string): number {
try {
if (!input || input.trim() === '') this.throwInvalidVersionFormat();
private async resolveVersionInput(): Promise<void> {
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`
);
}
if (semver.valid(this.inputVersion)) {
this.resolvedArgument.type = 'version';
this.resolvedArgument.value = this.inputVersion;
} else {
const [major, minor] = this.inputVersion.split('.');
let number = Number(input);
if (Number.isNaN(number) || number < 0) this.throwInvalidVersionFormat();
return number;
} catch {
this.throwInvalidVersionFormat();
return -1;
if (this.isNumericTag(major)) {
this.resolvedArgument.type = 'channel';
if (this.isNumericTag(minor)) {
this.resolvedArgument.value = `${major}.${minor}`;
} else {
const httpClient = new hc.HttpClient('actions/setup-dotnet', [], {
allowRetries: true,
maxRetries: 3
});
this.resolvedArgument.value = await this.getLatestVersion(
httpClient,
[major, minor]
);
}
}
this.resolvedArgument.qualityFlag = +major >= 6 ? true : false;
}
}
private throwInvalidVersionFormat() {
throw 'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*';
private isNumericTag(versionTag): boolean {
return /^\d+$/.test(versionTag);
}
/**
* If true exacatly one version should be resolved
*/
public isExactVersion(): boolean {
return this.isExactVersionSet;
public async createDotNetVersion(): Promise<{
type: string;
value: string;
qualityFlag: boolean;
}> {
await this.resolveVersionInput();
if (!this.resolvedArgument.type) {
return this.resolvedArgument;
}
if (IS_WINDOWS) {
this.resolvedArgument.type =
this.resolvedArgument.type === 'channel' ? '-Channel' : '-Version';
} else {
this.resolvedArgument.type =
this.resolvedArgument.type === 'channel' ? '--channel' : '--version';
}
return this.resolvedArgument;
}
public version(): string {
return this.fullversion;
private async getLatestVersion(
httpClient: hc.HttpClient,
versionParts: string[]
): Promise<string> {
const response = await httpClient.getJson<any>(
DotnetVersionResolver.DotNetCoreIndexUrl
);
const result = response.result || {};
let releasesInfo: any[] = result['releases-index'];
let releaseInfo = releasesInfo.find(info => {
let sdkParts: string[] = info['channel-version'].split('.');
return sdkParts[0] === versionParts[0];
});
if (!releaseInfo) {
throw new Error(
`Could not find info for version ${versionParts.join('.')} at ${
DotnetVersionResolver.DotNetCoreIndexUrl
}`
);
}
return releaseInfo['channel-version'];
}
static DotNetCoreIndexUrl: string =
'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json';
}
export class DotnetCoreInstaller {
constructor(version: string) {
this.version = version;
}
public async installDotnet() {
let output = '';
let resultCode = 0;
let calculatedVersion = await this.resolveVersion(
new DotNetVersionInfo(this.version)
);
var envVariables: {[key: string]: string} = {};
for (let key in process.env) {
if (process.env[key]) {
let value: any = process.env[key];
envVariables[key] = value;
}
}
if (IS_WINDOWS) {
let escapedScript = path
.join(__dirname, '..', 'externals', 'install-dotnet.ps1')
.replace(/'/g, "''");
let command = `& '${escapedScript}'`;
if (calculatedVersion) {
command += ` -Version ${calculatedVersion}`;
}
if (process.env['https_proxy'] != null) {
command += ` -ProxyAddress ${process.env['https_proxy']}`;
}
// This is not currently an option
if (process.env['no_proxy'] != null) {
command += ` -ProxyBypassList ${process.env['no_proxy']}`;
}
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
const powershellPath = await io.which('powershell', true);
var options: ExecOptions = {
listeners: {
stdout: (data: Buffer) => {
output += data.toString();
}
},
env: envVariables
};
resultCode = await exec.exec(
`"${powershellPath}"`,
[
'-NoLogo',
'-Sta',
'-NoProfile',
'-NonInteractive',
'-ExecutionPolicy',
'Unrestricted',
'-Command',
command
],
options
);
} else {
let escapedScript = path
.join(__dirname, '..', 'externals', 'install-dotnet.sh')
.replace(/'/g, "''");
chmodSync(escapedScript, '777');
const scriptPath = await io.which(escapedScript, true);
let scriptArguments: string[] = [];
if (calculatedVersion) {
scriptArguments.push('--version', calculatedVersion);
}
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
resultCode = await exec.exec(`"${scriptPath}"`, scriptArguments, {
listeners: {
stdout: (data: Buffer) => {
output += data.toString();
}
},
env: envVariables
});
}
private version: string;
private quality: QualityOptions;
private static readonly installationDirectoryWindows = path.join(
process.env['PROGRAMFILES'] + '',
'dotnet'
);
private static readonly installationDirectoryLinux = '/usr/share/dotnet';
private static readonly installationDirectoryMac = path.join(
process.env['HOME'] + '',
'.dotnet'
);
static addToPath() {
if (process.env['DOTNET_INSTALL_DIR']) {
core.addPath(process.env['DOTNET_INSTALL_DIR']);
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
} else {
if (IS_WINDOWS) {
// This is the default set in install-dotnet.ps1
core.addPath(
path.join(process.env['LocalAppData'] + '', 'Microsoft', 'dotnet')
);
core.addPath(DotnetCoreInstaller.installationDirectoryWindows);
core.exportVariable(
'DOTNET_ROOT',
path.join(process.env['LocalAppData'] + '', 'Microsoft', 'dotnet')
DotnetCoreInstaller.installationDirectoryWindows
);
} else if (IS_LINUX) {
core.addPath(DotnetCoreInstaller.installationDirectoryLinux);
core.exportVariable(
'DOTNET_ROOT',
DotnetCoreInstaller.installationDirectoryLinux
);
} else {
// This is the default set in install-dotnet.sh
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
core.addPath(DotnetCoreInstaller.installationDirectoryMac);
core.exportVariable(
'DOTNET_ROOT',
path.join(process.env['HOME'] + '', '.dotnet')
DotnetCoreInstaller.installationDirectoryMac
);
}
}
console.log(process.env['PATH']);
if (resultCode != 0) {
throw `Failed to install dotnet ${resultCode}. ${output}`;
}
}
// versionInfo - versionInfo of the SDK/Runtime
async resolveVersion(versionInfo: DotNetVersionInfo): Promise<string> {
if (versionInfo.isExactVersion()) {
return versionInfo.version();
}
constructor(version: string, quality: QualityOptions) {
this.version = version;
this.quality = quality;
}
const httpClient = new hc.HttpClient('actions/setup-dotnet', [], {
allowRetries: true,
maxRetries: 3
});
const releasesJsonUrl: string = await this.getReleasesJsonUrl(
httpClient,
versionInfo.version().split('.')
);
const releasesResponse = await httpClient.getJson<any>(releasesJsonUrl);
const releasesResult = releasesResponse.result || {};
let releasesInfo: any[] = releasesResult['releases'];
releasesInfo = releasesInfo.filter((releaseInfo: any) => {
return (
semver.satisfies(
releaseInfo['sdk']['version'],
versionInfo.version()
) ||
semver.satisfies(
releaseInfo['sdk']['version-display'],
versionInfo.version()
)
private setQuality(
dotnetVersion: DotnetVersion,
scriptArguments: string[]
): void {
const option = IS_WINDOWS ? '-Quality' : '--quality';
if (dotnetVersion.qualityFlag) {
scriptArguments.push(option, this.quality);
} else {
core.warning(
`'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A and A.x formats where the major tag is higher than 5. You specified: ${this.version}. 'dotnet-quality' input is ignored.`
);
});
// Exclude versions that are newer than the latest if using not exact
let latestSdk: string = releasesResult['latest-sdk'];
releasesInfo = releasesInfo.filter((releaseInfo: any) =>
semver.lte(releaseInfo['sdk']['version'], latestSdk)
);
// 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.`;
}
let release = releasesInfo[0];
return release['sdk']['version'];
}
private async getReleasesJsonUrl(
httpClient: hc.HttpClient,
versionParts: string[]
): Promise<string> {
const response = await httpClient.getJson<any>(DotNetCoreIndexUrl);
const result = response.result || {};
let releasesInfo: any[] = result['releases-index'];
public async installDotnet(): Promise<string> {
const windowsDefaultOptions = [
'-NoLogo',
'-Sta',
'-NoProfile',
'-NonInteractive',
'-ExecutionPolicy',
'Unrestricted',
'-Command'
];
const scriptName = IS_WINDOWS ? 'install-dotnet.ps1' : 'install-dotnet.sh';
const escapedScript = path
.join(__dirname, '..', 'externals', scriptName)
.replace(/'/g, "''");
let scriptArguments: string[];
let scriptPath = '';
releasesInfo = releasesInfo.filter((info: any) => {
// channel-version is the first 2 elements of the version (e.g. 2.1), filter out versions that don't match 2.1.x.
const sdkParts: string[] = info['channel-version'].split('.');
if (
versionParts.length >= 2 &&
!(versionParts[1] == 'x' || versionParts[1] == '*')
) {
return versionParts[0] == sdkParts[0] && versionParts[1] == sdkParts[1];
const versionResolver = new DotnetVersionResolver(this.version);
const dotnetVersion = await versionResolver.createDotNetVersion();
if (IS_WINDOWS) {
scriptArguments = ['&', `'${escapedScript}'`];
if (dotnetVersion.type) {
scriptArguments.push(dotnetVersion.type, dotnetVersion.value);
}
return versionParts[0] == sdkParts[0];
});
if (releasesInfo.length === 0) {
throw `Could not find info for version ${versionParts.join(
'.'
)} at ${DotNetCoreIndexUrl}`;
if (this.quality) {
this.setQuality(dotnetVersion, scriptArguments);
}
if (process.env['https_proxy'] != null) {
scriptArguments.push(`-ProxyAddress ${process.env['https_proxy']}`);
}
// This is not currently an option
if (process.env['no_proxy'] != null) {
scriptArguments.push(`-ProxyBypassList ${process.env['no_proxy']}`);
}
if (!process.env['DOTNET_INSTALL_DIR']) {
process.env['DOTNET_INSTALL_DIR'] =
DotnetCoreInstaller.installationDirectoryWindows;
}
scriptPath =
(await io.which('pwsh', false)) || (await io.which('powershell', true));
scriptArguments = windowsDefaultOptions.concat(scriptArguments);
} else {
chmodSync(escapedScript, '777');
scriptPath = await io.which(escapedScript, true);
scriptArguments = [];
if (dotnetVersion.type) {
scriptArguments.push(dotnetVersion.type, dotnetVersion.value);
}
if (this.quality) {
this.setQuality(dotnetVersion, scriptArguments);
}
if (!process.env['DOTNET_INSTALL_DIR']) {
process.env['DOTNET_INSTALL_DIR'] = IS_LINUX
? DotnetCoreInstaller.installationDirectoryLinux
: DotnetCoreInstaller.installationDirectoryMac;
}
}
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
const getExecOutputOptions = {
ignoreReturnCode: true,
env: process.env as {string: string}
};
const {exitCode, stdout} = await exec.getExecOutput(
`"${scriptPath}"`,
scriptArguments,
getExecOutputOptions
);
if (exitCode) {
throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`);
}
return releasesInfo[0]['releases.json'];
return this.outputDotnetVersion(
dotnetVersion.value,
process.env['DOTNET_INSTALL_DIR']
);
}
private version: string;
}
private async outputDotnetVersion(
version,
installationPath
): Promise<string> {
let versionsOnRunner: string[] = await readdir(
path.join(installationPath.replace(/'/g, ''), 'sdk')
);
const DotNetCoreIndexUrl: string =
'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json';
let installedVersion = semver.maxSatisfying(versionsOnRunner, version, {
includePrerelease: true
})!;
return installedVersion;
}
}

View File

@ -1,36 +1,71 @@
import * as core from '@actions/core';
import * as installer from './installer';
import {DotnetCoreInstaller} from './installer';
import * as fs from 'fs';
import * as path from 'path';
import path from 'path';
import semver from 'semver';
import * as auth from './authutil';
const qualityOptions = [
'daily',
'signed',
'validated',
'preview',
'ga'
] as const;
export type QualityOptions = typeof qualityOptions[number];
export async function run() {
try {
//
// dotnet-version is optional, but needs to be provided for most use cases.
// If supplied, install / use from the tool cache.
// global-version-file may be specified to point to a specific global.json
// and will be used to install an additional version.
// If not supplied, look for version in ./global.json.
// If a valid version still can't be identified, nothing will be installed.
// Proxy, auth, (etc) are still set up, even if no version is identified
//
let version = core.getInput('dotnet-version');
if (!version) {
const versions = core.getMultilineInput('dotnet-version');
const installedDotnetVersions: string[] = [];
const globalJsonFileInput = core.getInput('global-json-file');
if (globalJsonFileInput) {
const globalJsonPath = path.join(process.cwd(), globalJsonFileInput);
if (!fs.existsSync(globalJsonPath)) {
throw new Error(
`The specified global.json file '${globalJsonFileInput}' does not exist`
);
}
versions.push(getVersionFromGlobalJson(globalJsonPath));
}
if (!versions.length) {
// Try to fall back to global.json
core.debug('No version found, trying to find version from global.json');
const globalJsonPath = path.join(process.cwd(), 'global.json');
if (fs.existsSync(globalJsonPath)) {
const globalJson = JSON.parse(
fs.readFileSync(globalJsonPath, {encoding: 'utf8'})
);
if (globalJson.sdk && globalJson.sdk.version) {
version = globalJson.sdk.version;
}
versions.push(getVersionFromGlobalJson(globalJsonPath));
}
}
if (version) {
const dotnetInstaller = new installer.DotnetCoreInstaller(version);
await dotnetInstaller.installDotnet();
if (versions.length) {
const quality = core.getInput('dotnet-quality') as QualityOptions;
if (quality && !qualityOptions.includes(quality)) {
throw new Error(
`${quality} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`
);
}
let dotnetInstaller: DotnetCoreInstaller;
const uniqueVersions = new Set<string>(versions);
for (const version of uniqueVersions) {
dotnetInstaller = new DotnetCoreInstaller(version, quality);
const installedVersion = await dotnetInstaller.installDotnet();
installedDotnetVersions.push(installedVersion);
}
DotnetCoreInstaller.addToPath();
}
const sourceUrl: string = core.getInput('source-url');
@ -39,11 +74,42 @@ export async function run() {
auth.configAuthentication(sourceUrl, configFile);
}
const comparisonRange: string = globalJsonFileInput
? versions[versions.length - 1]!
: '*';
const versionToOutput = semver.maxSatisfying(
installedDotnetVersions,
comparisonRange,
{
includePrerelease: true
}
);
core.setOutput('dotnet-version', versionToOutput);
const matchersPath = path.join(__dirname, '..', '.github');
console.log(`##[add-matcher]${path.join(matchersPath, 'csc.json')}`);
core.info(`##[add-matcher]${path.join(matchersPath, 'csc.json')}`);
} catch (error) {
core.setFailed(error.message);
}
}
function getVersionFromGlobalJson(globalJsonPath: string): string {
let version: string = '';
const globalJson = JSON.parse(
// .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
fs.readFileSync(globalJsonPath, {encoding: 'utf8'}).trim()
);
if (globalJson.sdk && globalJson.sdk.version) {
version = globalJson.sdk.version;
const rollForward = globalJson.sdk.rollForward;
if (rollForward && rollForward === 'latestFeature') {
const [major, minor] = version.split('.');
version = `${major}.${minor}`;
}
}
return version;
}
run();

2
src/utils.ts Normal file
View File

@ -0,0 +1,2 @@
export const IS_WINDOWS = process.platform === 'win32';
export const IS_LINUX = process.platform === 'linux';