Compare commits

...

82 Commits

Author SHA1 Message Date
27dbb7f407 depricate ubuntu-20.04 2025-04-17 21:03:21 +05:30
9c99f11032 Add Publish Immutable Action 2025-04-17 20:53:27 +05:30
871f041373 Merge pull request #577 from actions/remove-cdn-fallback-v1
`v1` - Remove `dotnetcli.blob.core.windows.net` storage account fallback logic and update install scripts
2025-02-10 10:11:07 -05:00
67cd79ce76 Update workflow.yml to remove outdated URLs 2025-01-30 16:14:28 -05:00
b3da5ab48f Update workflow.yml 2025-01-29 16:50:14 -05:00
65c71668de add updated install scripts 2025-01-29 21:39:24 +00:00
f2d774a272 fix ci 2025-01-02 02:05:44 +00:00
8f3cbf74e2 get rid of extra space 2025-01-02 01:53:55 +00:00
e31c9045e5 remove extra spacing 2025-01-02 01:02:11 +00:00
0d16f91084 Remove storage account fallback logic (v1) 2025-01-02 00:47:52 +00:00
71a4fd9b27 V1 - Use new .NET CDN URLs and update to latest install scripts (#569)
* New cdn url changes

* Fix CI failures on macos-latest

* Add Fallback logic

* Fix proxy failures

* Update signed version
2024-12-26 14:05:33 -06: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
0cfae9b3a5 Automate releasing new versions of the setup-dotnet action 2021-04-26 16:02:03 +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
23 changed files with 5354 additions and 4371 deletions

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@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

View File

@ -1,8 +1,13 @@
name: Licensed name: Licensed
on: on:
push: {branches: main} push:
pull_request: {branches: main} branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs: jobs:
test: test:
@ -14,7 +19,7 @@ jobs:
- name: Install licensed - name: Install licensed
run: | run: |
cd $RUNNER_TEMP 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 tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed sudo mv licensed /usr/local/bin/licensed
- run: licensed status - run: licensed status

View File

@ -0,0 +1,20 @@
name: 'Publish Immutable Action Version'
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checking out
uses: actions/checkout@v4
- name: Publish
id: publish
uses: actions/publish-immutable-action@v0.0.4

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 }}

View File

@ -17,7 +17,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest] operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0'] dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0']
steps: steps:
- name: Checkout - name: Checkout

View File

@ -17,7 +17,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest] operating-system: [ubuntu-22.04, windows-latest, macos-13]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -32,13 +32,36 @@ jobs:
- name: Verify no unstaged changes - name: Verify no unstaged changes
if: runner.os != 'windows' if: runner.os != 'windows'
run: __tests__/verify-no-unstaged-changes.sh run: __tests__/verify-no-unstaged-changes.sh
test-setup-multiple-versions:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-22.04, 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 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: test-setup-full-version:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest] operating-system: [ubuntu-22.04, windows-latest, macos-13]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -71,7 +94,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest] operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -96,7 +119,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest] operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -120,7 +143,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
operating-system: [ubuntu-latest, windows-latest, macOS-latest] operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -140,18 +163,20 @@ jobs:
run: __tests__/verify-dotnet.ps1 3.1 2.2 run: __tests__/verify-dotnet.ps1 3.1 2.2
test-proxy: test-proxy:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
container: container:
image: mcr.microsoft.com/dotnet/core/runtime-deps:3.0-bionic image: ubuntu:22.04
options: --dns 127.0.0.1 options: --dns 127.0.0.1
services: services:
squid-proxy: squid-proxy:
image: datadog/squid:latest image: ubuntu/squid:latest
ports: ports:
- 3128:3128 - 3128:3128
env: env:
https_proxy: http://squid-proxy:3128 https_proxy: http://squid-proxy:3128
http_proxy: http://squid-proxy:3128 http_proxy: http://squid-proxy:3128
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -160,7 +185,7 @@ jobs:
- name: Install curl - name: Install curl
run: | run: |
apt update apt update
apt -y install curl apt -y install curl libssl-dev
- name: Setup dotnet 3.1.201 - name: Setup dotnet 3.1.201
uses: ./ uses: ./
with: with:
@ -172,10 +197,10 @@ jobs:
run: __tests__/verify-dotnet.sh 3.1.201 run: __tests__/verify-dotnet.sh 3.1.201
test-bypass-proxy: test-bypass-proxy:
runs-on: ubuntu-latest runs-on: ubuntu-22.04
env: env:
https_proxy: http://no-such-proxy:3128 https_proxy: http://no-such-proxy:3128
no_proxy: github.com,dotnetcli.blob.core.windows.net,download.visualstudio.microsoft.com,api.nuget.org,dotnetcli.azureedge.net no_proxy: github.com,download.visualstudio.microsoft.com,api.nuget.org,builds.dotnet.microsoft.com,ci.dot.net
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/core" name: "@actions/core"
version: 1.2.6 version: 1.6.0
type: npm type: npm
summary: Actions core lib summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core 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,9 +4,9 @@
<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> <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> </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 - registering problem matchers for error output
- setting up authentication to private package sources like GitHub Packages - setting up authentication to private package sources like GitHub Packages
@ -29,11 +29,24 @@ steps:
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' # SDK Version to use; x will use the latest version of the 3.1 channel
- run: dotnet build <my project> - 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: Preview version:
```yml ```yml
steps: steps:
- uses: actions@checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1 - uses: actions/setup-dotnet@v1
with: with:
dotnet-version: '6.0.x' dotnet-version: '6.0.x'
@ -93,10 +106,10 @@ steps:
- run: dotnet build <my project> - run: dotnet build <my project>
- name: Create the package - name: Create the package
run: dotnet pack --configuration Release <my project> 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 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 - uses: actions/setup-dotnet@v1
with: with:
source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json
@ -104,11 +117,21 @@ steps:
NUGET_AUTH_TOKEN: ${{secrets.AZURE_DEVOPS_PAT}} # Note, create a secret with this name in Settings NUGET_AUTH_TOKEN: ${{secrets.AZURE_DEVOPS_PAT}} # Note, create a secret with this name in Settings
- name: Publish the package to Azure Artifacts - name: Publish the package to Azure Artifacts
run: dotnet nuget push <my project>/bin/Release/*.nupkg 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 ## 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_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_CLI_TELEMETRY_OPTOUT - opt-out of telemetry being sent to Microsoft (default: false)

View File

@ -1,13 +1,13 @@
$dotnetPaths = @{ $dotnetPaths = @{
Linux = @("/usr/share/dotnet") Linux = "/usr/share/dotnet"
macOS = @("$env:HOME/.dotnet") macOS = "$env:HOME/.dotnet"
Windows = @("$env:ProgramFiles\dotnet/*", Windows = "$env:ProgramFiles\dotnet", "$env:LocalAppData\Microsoft\dotnet"
"$env:LocalAppData\Microsoft\dotnet/*")
} }
foreach ($path in $dotnetPaths[$args[0]]) { foreach ($srcPath in $dotnetPaths[$args[0]]) {
if (Test-Path $path) { if (Test-Path $srcPath) {
Write-Host "Clear $path path" Write-Host "Move $srcPath path"
Remove-Item $path -Recurse -Force $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); }, 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 () => { it('Acquires version of dotnet if no matching version is installed', async () => {
await getDotnet('3.1.201'); await getDotnet('3.1.201');
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true); 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> { async function getDotnet(version: string): Promise<void> {
const dotnetInstaller = new installer.DotnetCoreInstaller(version); const dotnetInstaller = new installer.DotnetCoreInstaller(version);
await dotnetInstaller.installDotnet(); await dotnetInstaller.installDotnet();
installer.DotnetCoreInstaller.addToPath();
} }

View File

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

View File

@ -7,6 +7,7 @@ const toolDir = path.join(__dirname, 'runner', 'tools2');
const tempDir = path.join(__dirname, 'runner', 'temp2'); const tempDir = path.join(__dirname, 'runner', 'temp2');
import * as setup from '../src/setup-dotnet'; import * as setup from '../src/setup-dotnet';
import * as dotnetInstaller from '../src/installer';
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
@ -19,7 +20,7 @@ describe('setup-dotnet tests', () => {
await io.rmRF(tempDir); await io.rmRF(tempDir);
}); });
afterAll(async () => { afterEach(async () => {
try { try {
await io.rmRF(path.join(process.cwd(), 'global.json')); await io.rmRF(path.join(process.cwd(), 'global.json'));
await io.rmRF(toolDir); await io.rmRF(toolDir);
@ -44,4 +45,26 @@ describe('setup-dotnet tests', () => {
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true); expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
} }
}, 400000); }, 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

@ -6,12 +6,15 @@ if (!$args[0])
$dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path } $dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path }
Write-Host "Found '$dotnet'" Write-Host "Found '$dotnet'"
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() } if($args.count -eq 1)
Write-Host "Version $version"
if (-not ($version.StartsWith($args[0].ToString())))
{ {
Write-Host "PATH='$env:PATH'" $version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
throw "Unexpected version" Write-Host "Version $version"
if (-not ($version.StartsWith($args[0].ToString())))
{
Write-Host "PATH='$env:PATH'"
throw "Unexpected version"
}
} }
if ($args[1]) if ($args[1])
@ -19,16 +22,17 @@ if ($args[1])
# SDKs are listed on multiple lines with the path afterwards in square brackets # SDKs are listed on multiple lines with the path afterwards in square brackets
$versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() } $versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
Write-Host "Installed versions: $versions" Write-Host "Installed versions: $versions"
$isInstalledVersion = $false $InstalledVersionCount = 0
foreach ($version in $versions) foreach($arg in $args){
{ foreach ($version in $versions)
if ($version.StartsWith($args[1].ToString()))
{ {
$isInstalledVersion = $true if ($version.StartsWith($arg.ToString()))
break {
$InstalledVersionCount++
}
} }
} }
if (-not $isInstalledVersion) if ( $InstalledVersionCount -ne $args.Count)
{ {
Write-Host "PATH='$env:PATH'" Write-Host "PATH='$env:PATH'"
throw "Unexpected version" throw "Unexpected version"
@ -53,6 +57,13 @@ if ($args[1])
throw "Unexpected output" throw "Unexpected output"
} }
} }
if ($args[2])
{
if ($sample_output -notlike "*Test Run Successful.*Test Run Successful.*Test Run Successful.*")
{
throw "Unexpected output"
}
}
else else
{ {
if ($sample_output -notlike "*Test Run Successful.*") if ($sample_output -notlike "*Test Run Successful.*")

View File

@ -1,12 +1,12 @@
name: 'Setup .NET Core SDK' 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' author: 'GitHub'
branding: branding:
icon: play icon: play
color: green color: green
inputs: inputs:
dotnet-version: dotnet-version:
description: 'Optional SDK version to use. If not provided, will install global.json version when available. 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: 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' 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: owner:

1391
dist/index.js vendored

File diff suppressed because it is too large Load Diff

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

View File

@ -165,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']) { if (process.env['DOTNET_INSTALL_DIR']) {
core.addPath(process.env['DOTNET_INSTALL_DIR']); core.addPath(process.env['DOTNET_INSTALL_DIR']);
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']); core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
@ -189,10 +195,6 @@ export class DotnetCoreInstaller {
} }
console.log(process.env['PATH']); console.log(process.env['PATH']);
if (resultCode != 0) {
throw new Error(`Failed to install dotnet ${resultCode}. ${output}`);
}
} }
// versionInfo - versionInfo of the SDK/Runtime // versionInfo - versionInfo of the SDK/Runtime
@ -283,7 +285,14 @@ export class DotnetCoreInstaller {
); );
} }
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 version: string;
@ -291,4 +300,4 @@ export class DotnetCoreInstaller {
} }
const DotNetCoreIndexUrl: string = const DotNetCoreIndexUrl: string =
'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json'; 'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';

View File

@ -13,32 +13,29 @@ export async function run() {
// If a valid version still can't be identified, nothing will be installed. // 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 // Proxy, auth, (etc) are still set up, even if no version is identified
// //
let version = core.getInput('dotnet-version'); let versions = core.getMultilineInput('dotnet-version');
if (!version) { if (!versions.length) {
// Try to fall back to global.json // Try to fall back to global.json
core.debug('No version found, trying to find version from global.json'); core.debug('No version found, trying to find version from global.json');
const globalJsonPath = path.join(process.cwd(), 'global.json'); const globalJsonPath = path.join(process.cwd(), 'global.json');
if (fs.existsSync(globalJsonPath)) { if (fs.existsSync(globalJsonPath)) {
const globalJson = JSON.parse( versions.push(getVersionFromGlobalJson(globalJsonPath));
// .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;
}
} }
} }
if (version) { if (versions.length) {
const includePrerelease: boolean = const includePrerelease: boolean =
(core.getInput('include-prerelease') || 'false').toLowerCase() === (core.getInput('include-prerelease') || 'false').toLowerCase() ===
'true'; 'true';
let dotnetInstaller!: installer.DotnetCoreInstaller;
const dotnetInstaller = new installer.DotnetCoreInstaller( for (const version of new Set<string>(versions)) {
version, dotnetInstaller = new installer.DotnetCoreInstaller(
includePrerelease version,
); includePrerelease
await dotnetInstaller.installDotnet(); );
await dotnetInstaller.installDotnet();
}
installer.DotnetCoreInstaller.addToPath();
} }
const sourceUrl: string = core.getInput('source-url'); const sourceUrl: string = core.getInput('source-url');
@ -54,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(); run();