Skip to content

Commit 0c36667

Browse files
committed
Build: Read nuget API key from file
After moving owner of repo, the build server was no longer authorized to push nugets. Update publish script to read API key from file Ignore Build/nuget-apikey.txt Add placeholder file with instructions
1 parent b2d853b commit 0c36667

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,4 @@ UpgradeLog*.XML
109109

110110
Artifacts
111111
Thumbs.db
112+
/Build/nuget-apikey.txt

Build/nuget-apikey-placeholder.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
INSERT API KEY HERE
2+
3+
* Copy this file to nuget-apikey.txt
4+
* Edit the new file
5+
* Insert API key above, as the only line in the file
6+
* Remove all other lines so the file only has one line with the API key

Build/nuget-publish.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
$root="$PSScriptRoot\.."
22
$nugetDir="$root\Artifacts\NuGet\"
3+
$apiKeyFile="nuget-apikey.txt"
4+
5+
$apiKey = Get-Content $apiKeyFile
6+
Write-Host "Using API key: $apiKey"
37

48
$list = gci -Path $nugetDir -Filter UnitsNet.*.nupkg | where-object {$_.Name -NotMatch "\.symbols\."}
59
foreach ($file in $list)
610
{
7-
write-host "Publishing nuget: $($file.Name)"
8-
Invoke-Expression "$root\Tools\nuget.exe push $($file.FullName)"
11+
Write-Host "Publishing nuget: $($file.Name)"
12+
Invoke-Expression "$root\Tools\nuget.exe push -ApiKey $apiKey $($file.FullName)"
913
}

0 commit comments

Comments
 (0)