diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-06-13 00:50:23 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-06-13 00:50:23 +0300 |
commit | cea97420a47c05a0a26dad90bb87d77a8eb4e0cb (patch) | |
tree | c6dbe2bf167e69488aa7bf10dcf1c6c102e7dadc /build | |
parent | 4864bda887f2ecec4e6bc6780b680ed995d89731 (diff) |
Update for nuget
Diffstat (limited to 'build')
-rw-r--r-- | build/CreateRelease.WPF.ps1 | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/build/CreateRelease.WPF.ps1 b/build/CreateRelease.WPF.ps1 index 9521bea..3a9ef99 100644 --- a/build/CreateRelease.WPF.ps1 +++ b/build/CreateRelease.WPF.ps1 @@ -35,6 +35,7 @@ Set-Location $PSScriptRoot\.. $enableMSI = $true #$buildOnly = 'linux-x64' #$buildOnly = 'win-x64' +$enableNugetPublish = $true # Profilling $stopWatch = New-Object -TypeName System.Diagnostics.Stopwatch $deployStopWatch = New-Object -TypeName System.Diagnostics.Stopwatch @@ -130,6 +131,29 @@ $runtimes = #Invoke-WebRequest -Uri $appImageUrl -OutFile $appImageFilePath #wsl chmod a+x $appImageFilePath +if($null -ne $enableNugetPublish -and $enableNugetPublish) +{ + $nugetApiKeyFile = 'build/nuget_api.key' + if (Test-Path -Path $nugetApiKeyFile -PathType Leaf) + { + Write-Output "Creating nuget package" + dotnet pack UVtools.Core --configuration 'Release' + + $nupkg = "UVtools.Core/bin/Release/UVtools.Core.$version.nupkg" + + if (Test-Path -Path $nupkg -PathType Leaf){ + $nugetApiKeyFile = (Get-Content $nugetApiKeyFile) + dotnet nuget push $nupkg --api-key $nugetApiKeyFile --source https://api.nuget.org/v3/index.json + #Remove-Item $nupkg + }else { + Write-Error "Nuget package publish failed!" + Write-Error "File '$nupkg' was not found" + return + } + } +} +return + foreach ($obj in $runtimes.GetEnumerator()) { if(![string]::IsNullOrWhiteSpace($buildOnly) -and !$buildOnly.Equals($obj.Name)) {continue} # Configuration @@ -228,7 +252,7 @@ $stopWatch.Stop() #> # MSI Installer for Windows -if($enableMSI) +if($null -ne $enableMSI -and $enableMSI) { $deployStopWatch.Restart() $runtime = 'win-x64' |