Compare commits

..

190 Commits

Author SHA1 Message Date
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
8aad93f856 Action input text update 2020-09-21 14:11:39 -07:00
30 changed files with 4749 additions and 3714 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.

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

@ -0,0 +1,51 @@
# `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@v2
- name: Set Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm ci
- 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@v2
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

View File

@ -1,8 +1,13 @@
name: Licensed
on:
push: {branches: main}
pull_request: {branches: main}
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
@ -14,7 +19,7 @@ jobs:
- 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.3.1/licensed-3.3.1-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.1.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@v2
- 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:
@ -28,8 +32,8 @@ jobs:
- name: Verify no unstaged changes
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
@ -38,25 +42,32 @@ jobs:
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
- 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@v2
- 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: ./
@ -70,70 +81,86 @@ jobs:
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 "DOTNET_INSTALL_DIR=/Users/runner/.dotnet2" >> $GITHUB_ENV
- name: Set new tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet2" >> $GITHUB_ENV
- name: Set new tool cache (Windows)
if: runner.os == 'windows'
shell: bash
run: |
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet2" >> $GITHUB_ENV
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@v2
- 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
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@v2
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 3.1.x
uses: ./
with:
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 3.1 2.2
# Clear cache before .x version install
- name: Set new tool cache (macOS)
if: runner.os == 'macos'
run: |
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet3" >> $GITHUB_ENV
- name: Set new tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet3" >> $GITHUB_ENV
- name: Set new tool cache (Windows)
if: runner.os == 'windows'
shell: bash
run: |
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet3" >> $GITHUB_ENV
- name: Setup dotnet 2.0.x
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@v2
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet 3.1.*
uses: ./
with:
dotnet-version: 2.0.x
# Clear cache before .* version install
- name: Set new tool cache (macOS)
if: runner.os == 'macos'
run: |
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet4" >> $GITHUB_ENV
- name: Set new tool cache (Ubuntu)
if: runner.os == 'linux'
run: |
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet4" >> $GITHUB_ENV
- name: Set new tool cache (Windows)
if: runner.os == 'windows'
shell: bash
run: |
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet4" >> $GITHUB_ENV
- name: Setup dotnet 2.0.*
dotnet-version: 3.1.*
- name: Setup dotnet 2.2.*
uses: ./
with:
dotnet-version: 2.0.*
dotnet-version: 2.2.*
- name: Verify dotnet
shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1 2.2
test-proxy:
runs-on: ubuntu-latest

View File

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

View File

@ -0,0 +1,32 @@
---
name: "@actions/http-client"
version: 1.0.11
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/http-client#readme
license: mit
licenses:
- sources: LICENSE
text: |
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
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: []

View File

@ -4,16 +4,16 @@
<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>
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
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
@ -23,12 +23,36 @@ See [action.yml](action.yml)
Basic:
```yaml
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel
- run: dotnet build <my project>
```
Multiple versions:
> 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.
```yml
steps:
- uses: actions/checkout@v2
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
5.0.x
- run: dotnet build <my project>
```
Preview version:
```yml
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true
- run: dotnet build <my project>
```
Matrix Testing:
```yaml
@ -37,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: [ '2.2.103', '3.0', '3.1.x' ]
dotnet: [ '2.1.x', '3.1.x', '5.0.x' ]
name: Dotnet ${{ matrix.dotnet }} sample
steps:
- uses: actions/checkout@v2
@ -59,7 +83,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.2.103'
dotnet-version: '2.1.x'
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
@ -82,10 +106,10 @@ steps:
- 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
# Authenticates packages to push to Azure Artifacts
- uses: actions/setup-dotnet@v1
with:
source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json
@ -93,11 +117,21 @@ steps:
NUGET_AUTH_TOKEN: ${{secrets.AZURE_DEVOPS_PAT}} # Note, create a secret with this name in Settings
- name: Publish the package to Azure Artifacts
run: dotnet nuget push <my project>/bin/Release/*.nupkg
# Authenticates packages to push to nuget.org.
# It's only the way to push a package to nuget.org feed for macOS/Linux machines due to API key config store limitations.
- uses: actions/setup-dotnet@v1
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 }}
```
## Environment Variables to use with dotnet
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
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
- 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)
@ -113,7 +147,7 @@ build:
- uses: actions/checkout@main
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.100' # SDK Version to use.
dotnet-version: '3.1.x' # SDK Version to use.
```
# License

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

@ -32,6 +32,27 @@ describe('installer tests', () => {
}
}, 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);
@ -126,4 +147,5 @@ function normalizeFileContents(contents: string): string {
async function getDotnet(version: string): Promise<void> {
const dotnetInstaller = new installer.DotnetCoreInstaller(version);
await dotnetInstaller.installDotnet();
installer.DotnetCoreInstaller.addToPath();
}

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

@ -7,6 +7,7 @@ const toolDir = path.join(__dirname, 'runner', 'tools2');
const tempDir = path.join(__dirname, 'runner', 'temp2');
import * as setup from '../src/setup-dotnet';
import * as dotnetInstaller from '../src/installer';
const IS_WINDOWS = process.platform === 'win32';
@ -19,7 +20,7 @@ describe('setup-dotnet tests', () => {
await io.rmRF(tempDir);
});
afterAll(async () => {
afterEach(async () => {
try {
await io.rmRF(path.join(process.cwd(), 'global.json'));
await io.rmRF(toolDir);
@ -44,4 +45,26 @@ describe('setup-dotnet tests', () => {
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
}
}, 400000);
it('Acquires version of dotnet from global.json with rollForward option, install the latest patch', async () => {
const globalJsonPath = path.join(process.cwd(), 'global.json');
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version":"3.1.201",${os.EOL}"rollForward":"latestFeature"${os.EOL}}${os.EOL}}`;
if (!fs.existsSync(globalJsonPath)) {
fs.writeFileSync(globalJsonPath, jsonContents);
}
const version = '3.1';
const installer = new dotnetInstaller.DotnetCoreInstaller(version);
const patchVersion = await installer.resolveVersion(
new dotnetInstaller.DotNetVersionInfo(version)
);
await setup.run();
expect(fs.existsSync(path.join(toolDir, 'sdk', patchVersion))).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);
}
}, 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

@ -13,6 +13,8 @@ describe('version tests', () => {
);
each([
['3.x', '3.x'],
['3.*', '3.*'],
['3.1.x', '3.1'],
['1.1.*', '1.1'],
['2.0', '2.0']
@ -42,7 +44,6 @@ describe('version tests', () => {
'.2.3',
'.2.x',
'1',
'2.x',
'*.*.1',
'*.1',
'*.',

View File

@ -1,18 +1,21 @@
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'
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.'
include-prerelease:
description: 'Whether prerelease versions should be matched with non-exact versions (for example 5.0.0-preview.6 being matched by 5, 5.0, 5.x or 5.0.x). Defaults to false if not provided.'
required: False
runs:
using: 'node12'
main: 'dist/index.js'

1446
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -22,3 +22,13 @@ If you would like to contribute there are a few things to consider:
## Writing tests
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.
## Creating new version
Details on versioning can be found here: https://github.com/actions/toolkit/blob/main/docs/action-versioning.md
Create a new release using the UI. Version format should be `v1.x.x`. Creating a new major version requires reaction from users and should be done only with breaking changes.
Once the new release is created, the v1 tag needs to be updated as well.
```
git tag -fa v1 -m "Update v1 tag"
git push origin v1 --force
```

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3965
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/core": "^1.6.0",
"@actions/exec": "^1.0.4",
"@actions/github": "^1.1.0",
"@actions/http-client": "^1.0.8",
@ -40,15 +40,15 @@
"xmlbuilder": "^13.0.2"
},
"devDependencies": {
"@types/jest": "^25.2.3",
"@types/jest": "^27.0.2",
"@types/node": "^12.12.62",
"@types/semver": "^6.2.2",
"@zeit/ncc": "^0.21.1",
"husky": "^4.3.0",
"jest": "^26.4.2",
"jest-circus": "^26.4.2",
"husky": "^7.0.2",
"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

@ -13,7 +13,9 @@ export function configAuthentication(
) {
const existingNuGetConfig: string = path.resolve(
processRoot,
existingFileLocation == '' ? 'nuget.config' : existingFileLocation
existingFileLocation === ''
? getExistingNugetConfig(processRoot)
: existingFileLocation
);
const tempNuGetConfig: string = path.resolve(
@ -25,6 +27,21 @@ 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,
@ -109,9 +126,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."
);
}

View File

@ -29,8 +29,7 @@ export class DotNetVersionInfo {
return;
}
//Note: No support for previews when using generic
let parts: string[] = version.split('.');
const parts: string[] = version.split('.');
if (parts.length < 2 || parts.length > 3) this.throwInvalidVersionFormat();
@ -38,8 +37,10 @@ export class DotNetVersionInfo {
this.throwInvalidVersionFormat();
}
let major = this.getVersionNumberOrThrow(parts[0]);
let minor = this.getVersionNumberOrThrow(parts[1]);
const major = this.getVersionNumberOrThrow(parts[0]);
const minor = ['x', '*'].includes(parts[1])
? parts[1]
: this.getVersionNumberOrThrow(parts[1]);
this.fullversion = major + '.' + minor;
}
@ -60,7 +61,9 @@ export class DotNetVersionInfo {
}
private throwInvalidVersionFormat() {
throw 'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*';
throw new Error(
'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*'
);
}
/**
@ -76,8 +79,9 @@ export class DotNetVersionInfo {
}
export class DotnetCoreInstaller {
constructor(version: string) {
constructor(version: string, includePrerelease: boolean = false) {
this.version = version;
this.includePrerelease = includePrerelease;
}
public async installDotnet() {
@ -161,6 +165,12 @@ export class DotnetCoreInstaller {
});
}
if (resultCode != 0) {
throw new Error(`Failed to install dotnet ${resultCode}. ${output}`);
}
}
static addToPath() {
if (process.env['DOTNET_INSTALL_DIR']) {
core.addPath(process.env['DOTNET_INSTALL_DIR']);
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
@ -185,10 +195,6 @@ export class DotnetCoreInstaller {
}
console.log(process.env['PATH']);
if (resultCode != 0) {
throw `Failed to install dotnet ${resultCode}. ${output}`;
}
}
// versionInfo - versionInfo of the SDK/Runtime
@ -212,13 +218,15 @@ export class DotnetCoreInstaller {
let releasesInfo: any[] = releasesResult['releases'];
releasesInfo = releasesInfo.filter((releaseInfo: any) => {
return (
semver.satisfies(
releaseInfo['sdk']['version'],
versionInfo.version()
) ||
semver.satisfies(releaseInfo['sdk']['version'], versionInfo.version(), {
includePrerelease: this.includePrerelease
}) ||
semver.satisfies(
releaseInfo['sdk']['version-display'],
versionInfo.version()
versionInfo.version(),
{
includePrerelease: this.includePrerelease
}
)
);
});
@ -227,16 +235,22 @@ export class DotnetCoreInstaller {
let latestSdk: string = releasesResult['latest-sdk'];
releasesInfo = releasesInfo.filter((releaseInfo: any) =>
semver.lte(releaseInfo['sdk']['version'], latestSdk)
semver.lte(releaseInfo['sdk']['version'], latestSdk, {
includePrerelease: this.includePrerelease
})
);
// Sort for latest version
releasesInfo = releasesInfo.sort((a, b) =>
semver.rcompare(a['sdk']['version'], b['sdk']['version'])
semver.rcompare(a['sdk']['version'], b['sdk']['version'], {
includePrerelease: this.includePrerelease
})
);
if (releasesInfo.length == 0) {
throw `Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`;
throw new Error(
`Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`
);
}
let release = releasesInfo[0];
@ -264,15 +278,25 @@ export class DotnetCoreInstaller {
});
if (releasesInfo.length === 0) {
throw `Could not find info for version ${versionParts.join(
'.'
)} at ${DotNetCoreIndexUrl}`;
throw new Error(
`Could not find info for version ${versionParts.join(
'.'
)} at ${DotNetCoreIndexUrl}`
);
}
return releasesInfo[0]['releases.json'];
const releaseInfo = releasesInfo[0];
if (releaseInfo['support-phase'] === 'eol') {
core.warning(
`${releaseInfo['product']} ${releaseInfo['channel-version']} is no longer supported and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the .NET support policy.`
);
}
return releaseInfo['releases.json'];
}
private version: string;
private includePrerelease: boolean;
}
const DotNetCoreIndexUrl: string =

View File

@ -13,24 +13,29 @@ export async function run() {
// 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) {
let versions = core.getMultilineInput('dotnet-version');
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 includePrerelease: boolean =
(core.getInput('include-prerelease') || 'false').toLowerCase() ===
'true';
let dotnetInstaller!: installer.DotnetCoreInstaller;
for (const version of new Set<string>(versions)) {
dotnetInstaller = new installer.DotnetCoreInstaller(
version,
includePrerelease
);
await dotnetInstaller.installDotnet();
}
installer.DotnetCoreInstaller.addToPath();
}
const sourceUrl: string = core.getInput('source-url');
@ -46,4 +51,21 @@ export async function run() {
}
}
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();