You've already forked setup-dotnet
							
							
				mirror of
				https://github.com/actions/setup-dotnet.git
				synced 2025-11-04 17:06:35 +07:00 
			
		
		
		
	Compare commits
	
		
			29 Commits
		
	
	
		
			v1.8.2
			...
			add-publis
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 27dbb7f407 | |||
| 9c99f11032 | |||
| 871f041373 | |||
| 67cd79ce76 | |||
| b3da5ab48f | |||
| 65c71668de | |||
| f2d774a272 | |||
| 8f3cbf74e2 | |||
| e31c9045e5 | |||
| 0d16f91084 | |||
| 71a4fd9b27 | |||
| 608ee757cf | |||
| e54e706650 | |||
| c20f59e04a | |||
| 13b852df87 | |||
| f85bcda870 | |||
| 499789684c | |||
| 76ddd67c90 | |||
| 550702114f | |||
| e3ce4164b3 | |||
| 463326422f | |||
| 547d075822 | |||
| fc9265379f | |||
| 32c76e2669 | |||
| 8ca0cf75a1 | |||
| 7f88dbf08f | |||
| af0ed6536b | |||
| 9dd9d27e57 | |||
| 44530e8569 | 
							
								
								
									
										2
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							@ -44,7 +44,7 @@ jobs:
 | 
			
		||||
        id: diff
 | 
			
		||||
 | 
			
		||||
      # If index.js was different than expected, upload the expected version as an artifact
 | 
			
		||||
      - uses: actions/upload-artifact@v2
 | 
			
		||||
      - uses: actions/upload-artifact@v4
 | 
			
		||||
        if: ${{ failure() && steps.diff.conclusion == 'failure' }}
 | 
			
		||||
        with:
 | 
			
		||||
          name: dist
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							@ -7,6 +7,7 @@ on:
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  test:
 | 
			
		||||
@ -18,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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								.github/workflows/publish-immutable-action.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/publish-immutable-action.yml
									
									
									
									
										vendored
									
									
										Normal 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
 | 
			
		||||
							
								
								
									
										2
									
								
								.github/workflows/test-dotnet.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/test-dotnet.yml
									
									
									
									
										vendored
									
									
								
							@ -17,7 +17,7 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      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']
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										47
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							@ -17,7 +17,7 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        operating-system: [ubuntu-latest, windows-latest, macOS-latest]
 | 
			
		||||
        operating-system: [ubuntu-22.04, windows-latest, macos-13]
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Checkout
 | 
			
		||||
      uses: actions/checkout@v2
 | 
			
		||||
@ -32,13 +32,36 @@ jobs:
 | 
			
		||||
    - name: Verify no unstaged changes
 | 
			
		||||
      if: runner.os != 'windows'
 | 
			
		||||
      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:
 | 
			
		||||
    runs-on: ${{ matrix.operating-system }}
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        operating-system: [ubuntu-latest, windows-latest, macOS-latest]
 | 
			
		||||
        operating-system: [ubuntu-22.04, windows-latest, macos-13]
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
@ -71,7 +94,7 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        operating-system: [ubuntu-latest, windows-latest, macOS-latest]
 | 
			
		||||
        operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
@ -96,7 +119,7 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        operating-system: [ubuntu-latest, windows-latest, macOS-latest]
 | 
			
		||||
        operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
@ -120,7 +143,7 @@ jobs:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        operating-system: [ubuntu-latest, windows-latest, macOS-latest]
 | 
			
		||||
        operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
@ -140,18 +163,20 @@ jobs:
 | 
			
		||||
        run: __tests__/verify-dotnet.ps1 3.1 2.2
 | 
			
		||||
 | 
			
		||||
  test-proxy:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    container:
 | 
			
		||||
      image: mcr.microsoft.com/dotnet/core/runtime-deps:3.0-bionic
 | 
			
		||||
      image: ubuntu:22.04
 | 
			
		||||
      options: --dns 127.0.0.1
 | 
			
		||||
    services:
 | 
			
		||||
      squid-proxy:
 | 
			
		||||
        image: datadog/squid:latest
 | 
			
		||||
        image: ubuntu/squid:latest
 | 
			
		||||
        ports:
 | 
			
		||||
          - 3128:3128
 | 
			
		||||
    env:
 | 
			
		||||
      https_proxy: http://squid-proxy:3128
 | 
			
		||||
      http_proxy: http://squid-proxy:3128
 | 
			
		||||
      DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
@ -160,7 +185,7 @@ jobs:
 | 
			
		||||
      - name: Install curl
 | 
			
		||||
        run: |
 | 
			
		||||
          apt update
 | 
			
		||||
          apt -y install curl
 | 
			
		||||
          apt -y install curl libssl-dev
 | 
			
		||||
      - name: Setup dotnet 3.1.201
 | 
			
		||||
        uses: ./
 | 
			
		||||
        with:
 | 
			
		||||
@ -172,10 +197,10 @@ jobs:
 | 
			
		||||
        run: __tests__/verify-dotnet.sh 3.1.201
 | 
			
		||||
 | 
			
		||||
  test-bypass-proxy:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    env:
 | 
			
		||||
      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:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							@ -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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										32
									
								
								.licenses/npm/@actions/http-client-1.0.11.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								.licenses/npm/@actions/http-client-1.0.11.dep.yml
									
									
									
										generated
									
									
									
										Normal 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: []
 | 
			
		||||
							
								
								
									
										17
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								README.md
									
									
									
									
									
								
							@ -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>
 | 
			
		||||
</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
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,20 @@ steps:
 | 
			
		||||
    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:
 | 
			
		||||
 | 
			
		||||
@ -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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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>
 | 
			
		||||
 | 
			
		||||
@ -6,12 +6,15 @@ if (!$args[0])
 | 
			
		||||
$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 (-not ($version.StartsWith($args[0].ToString())))
 | 
			
		||||
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])
 | 
			
		||||
@ -19,16 +22,17 @@ if ($args[1])
 | 
			
		||||
  # SDKs are listed on multiple lines with the path afterwards in square brackets
 | 
			
		||||
  $versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
 | 
			
		||||
  Write-Host "Installed versions: $versions"
 | 
			
		||||
  $isInstalledVersion = $false
 | 
			
		||||
  foreach ($version in $versions)
 | 
			
		||||
  {
 | 
			
		||||
    if ($version.StartsWith($args[1].ToString())) 
 | 
			
		||||
  $InstalledVersionCount = 0
 | 
			
		||||
  foreach($arg in $args){
 | 
			
		||||
    foreach ($version in $versions)
 | 
			
		||||
    {
 | 
			
		||||
      $isInstalledVersion = $true
 | 
			
		||||
      break
 | 
			
		||||
      if ($version.StartsWith($arg.ToString())) 
 | 
			
		||||
      {
 | 
			
		||||
        $InstalledVersionCount++
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (-not $isInstalledVersion)
 | 
			
		||||
   }
 | 
			
		||||
  if ( $InstalledVersionCount -ne $args.Count)
 | 
			
		||||
  {
 | 
			
		||||
    Write-Host "PATH='$env:PATH'"
 | 
			
		||||
    throw "Unexpected version"
 | 
			
		||||
@ -53,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.*")
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,7 @@ branding:
 | 
			
		||||
  color: green
 | 
			
		||||
inputs:
 | 
			
		||||
  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:
 | 
			
		||||
    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:
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1371
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1371
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3007
									
								
								externals/install-dotnet.ps1
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3007
									
								
								externals/install-dotnet.ps1
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										958
									
								
								externals/install-dotnet.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										958
									
								
								externals/install-dotnet.sh
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3938
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3938
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										12
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								package.json
									
									
									
									
									
								
							@ -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"
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
@ -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']) {
 | 
			
		||||
      core.addPath(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']);
 | 
			
		||||
 | 
			
		||||
    if (resultCode != 0) {
 | 
			
		||||
      throw new Error(`Failed to install dotnet ${resultCode}. ${output}`);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 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;
 | 
			
		||||
@ -291,4 +300,4 @@ export class DotnetCoreInstaller {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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';
 | 
			
		||||
 | 
			
		||||
@ -13,26 +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)) {
 | 
			
		||||
        version = getVersionFromGlobalJson(globalJsonPath);
 | 
			
		||||
        versions.push(getVersionFromGlobalJson(globalJsonPath));
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (version) {
 | 
			
		||||
    if (versions.length) {
 | 
			
		||||
      const includePrerelease: boolean =
 | 
			
		||||
        (core.getInput('include-prerelease') || 'false').toLowerCase() ===
 | 
			
		||||
        'true';
 | 
			
		||||
 | 
			
		||||
      const dotnetInstaller = new installer.DotnetCoreInstaller(
 | 
			
		||||
        version,
 | 
			
		||||
        includePrerelease
 | 
			
		||||
      );
 | 
			
		||||
      await dotnetInstaller.installDotnet();
 | 
			
		||||
      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');
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user