From cea97420a47c05a0a26dad90bb87d77a8eb4e0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Concei=C3=A7=C3=A3o?= Date: Sat, 12 Jun 2021 22:50:23 +0100 Subject: [PATCH] Update for nuget --- .gitignore | 2 ++ README.md | 19 ++++++++++++++----- UVtools.Core/UVtools.Core.csproj | 4 +++- build/CreateRelease.WPF.ps1 | 26 +++++++++++++++++++++++++- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 25e7868..82742f5 100644 --- a/.gitignore +++ b/.gitignore @@ -354,3 +354,5 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ UVtools.Platforms/linux-x64/libcvextern.so + +build/nuget_api.key \ No newline at end of file diff --git a/README.md b/README.md index 9a4fa77..6a70b96 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # UVtools -[![License](https://img.shields.io/github/license/sn4k3/UVtools)](https://github.com/sn4k3/UVtools/blob/master/LICENSE) -[![GitHub repo size](https://img.shields.io/github/repo-size/sn4k3/UVtools)](https://github.com/sn4k3/UVtools) -[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/sn4k3/UVtools?include_prereleases)](https://github.com/sn4k3/UVtools/releases) -[![Downloads](https://img.shields.io/github/downloads/sn4k3/UVtools/total)](https://github.com/sn4k3/UVtools/releases) +[![License](https://img.shields.io/github/license/sn4k3/UVtools?style=flat-square)](https://github.com/sn4k3/UVtools/blob/master/LICENSE) +[![GitHub repo size](https://img.shields.io/github/repo-size/sn4k3/UVtools?style=flat-square)](https://github.com/sn4k3/UVtools) +[![GitHub repo size](https://img.shields.io/github/languages/code-size/sn4k3/UVtools?style=flat-square)](https://github.com/sn4k3/UVtools) +[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/sn4k3/UVtools?include_prereleases&style=flat-square)](https://github.com/sn4k3/UVtools/releases) +[![Downloads](https://img.shields.io/github/downloads/sn4k3/UVtools/total?style=flat-square)](https://github.com/sn4k3/UVtools/releases) +[![Nuget](https://img.shields.io/nuget/v/UVtools.Core?style=flat-square)](https://www.nuget.org/packages/UVtools.Core) **MSLA/DLP, file analysis, calibration, repair, conversion and manipulation** @@ -408,7 +410,14 @@ There are multiple ways to open your file: # Library -> Developers -Are you a developer? This project include a .NET 5.0 library (UVtools.Core) that can be referenced in your application to make use of my work. Easy to use calls that allow you work with the formats. For more information navigate main code. +Are you a developer? +This project include a .NET 5.0 library (UVtools.Core) that can be referenced in your application to make use of my work. +Easy to use calls that allow you work with the formats. For more information navigate main code to see some calls. + +Nuget package: https://www.nuget.org/packages/UVtools.Core +```powershell +dotnet add package UVtools.Core +``` ## Develop and build from Source diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index a11e5bd..00fcf9e 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -15,6 +15,8 @@ UVtools.png AnyCPU;x64 false + + msla, dlp, resin, printer, slicer, 3d printing, image processing, layers @@ -39,7 +41,7 @@ True - + True 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'