-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.sh
executable file
·45 lines (37 loc) · 1005 Bytes
/
action.sh
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
#!/bin/bash
main(){
if [[ ! -f ~/NuGet.config ]]; then
echo '<?xml version="1.0" encoding="utf-8"?><configuration/>' > ~/NuGet.Config
fi
if [[ "$owner" == "" ]]; then
owner=${GITHUB_REPOSITORY%%/*}
echo "Note: owner defaulting to $owner"
fi
if [[ "$name" == "" ]]; then
name=GitHub-$owner
echo "Note: source name defaulting to $name"
fi
if [[ "$token" == "" ]]; then
token=$GITHUB_TOKEN
echo "Note: using github token."
fi
echo "Authenticating to $owner NuPkg Source"
if [[ "$RUNNER_OS" == "Windows" ]]; then
configfile="$APPDATA\NuGet\NuGet.Config"
if [[ "$force_cleartext_storage" == "true" ]] || [[ -z "$force_cleartext_storage" ]]; then
extra_args=--store-password-in-clear-text
else
extra_args=
fi
else
configfile=~/NuGet.Config
extra_args=--store-password-in-clear-text
fi
dotnet nuget add source "https://nuget.pkg.github.com/$owner/index.json" \
--configfile $configfile \
-n "$name" \
-u "$owner" \
-p "$token" \
$extra_args
}
main