-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
105 lines (85 loc) · 3.65 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: "setup-dotnet"
description: "A wrapper around the official actions/setup-dotnet action with extra features"
author: "xt0rted"
branding:
icon: "play"
color: "green"
inputs:
dotnet-version:
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"
required: false
global-json-file:
description: "Optional global.json location, if your global.json isn't located in the root of the repo."
required: false
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"
required: false
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"
required: false
config-file:
description: "Optional NuGet.config location, if your NuGet.config isn't located in the root of the repo."
required: false
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
colored-output:
description: "Sets the required environment variables to force color output from dotnet."
default: true
required: false
strip-comments-from-global-json:
description: "Whether to strip comments from the `global.json` file."
default: true
required: false
nuget_auth_token:
description: "Optional authentication token used with `source-url`."
required: false
runs:
using: "composite"
steps:
- shell: bash
run: |
if [ "${{ inputs.colored-output }}" == "true" ]; then
echo "DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION=true" >> $GITHUB_ENV
echo "TERM=xterm" >> $GITHUB_ENV
fi
- shell: bash
run: |
case "${{ runner.os }}" in
macOS) echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet" >> $GITHUB_ENV;;
Linux) echo "DOTNET_INSTALL_DIR=/usr/share/dotnet" >> $GITHUB_ENV;;
Windows) echo "DOTNET_INSTALL_DIR=C:\Program Files\dotnet" >> $GITHUB_ENV;;
*) echo "::warning::Unsupported runner os: ${{ runner.os }}";;
esac
- shell: bash
id: meta
run: |
if [[ -f "global.json" ]]; then
echo "has-global-json=true" >> $GITHUB_OUTPUT
else
echo "has-global-json=false" >> $GITHUB_OUTPUT
fi
- shell: bash
run: |
if [[ "${{ steps.meta.outputs.has-global-json }}" == "true" && "${{ inputs.strip-comments-from-global-json }}" == "true" ]]; then
cp global.json global.json.copy
npx -y strip-json-comments-cli global.json.copy > global.json
rm global.json.copy
fi
- uses: actions/setup-dotnet@v2.1.0
with:
dotnet-version: ${{ inputs.dotnet-version }}
global-json-file: ${{ inputs.global-json-file }}
source-url: ${{ inputs.source-url }}
owner: ${{ inputs.owner }}
config-file: ${{ inputs.config-file }}
include-prerelease: ${{ inputs.include-prerelease }}
env:
NUGET_AUTH_TOKEN: ${{ inputs.nuget_auth_token }}
- shell: bash
run: |
if [[ "${{ steps.meta.outputs.has-global-json }}" == "true" && "${{ inputs.strip-comments-from-global-json }}" == "true" ]]; then
git checkout -- global.json
fi
- shell: bash
run: dotnet --list-sdks