From ba9b1eddf110386c4baf5bfb6d1705be70b09f64 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Tue, 27 Dec 2022 02:16:24 -0500 Subject: [PATCH] Added publishing steps. --- build.cmd | 2 -- dist.pack.bat | 3 +++ dist.publish2nugetdotorg.bat | 2 ++ sign.ps1 | 20 ++++++++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) delete mode 100644 build.cmd create mode 100644 dist.pack.bat create mode 100644 dist.publish2nugetdotorg.bat create mode 100644 sign.ps1 diff --git a/build.cmd b/build.cmd deleted file mode 100644 index 908a09c..0000000 --- a/build.cmd +++ /dev/null @@ -1,2 +0,0 @@ -powershell -file build.ps1 -powershell -file post.build.ps1 diff --git a/dist.pack.bat b/dist.pack.bat new file mode 100644 index 0000000..8387af9 --- /dev/null +++ b/dist.pack.bat @@ -0,0 +1,3 @@ +powershell -ExecutionPolicy Bypass -file build.ps1 +powershell -ExecutionPolicy Bypass -file post.build.ps1 +powershell -ExecutionPolicy Bypass -file sign.ps1 diff --git a/dist.publish2nugetdotorg.bat b/dist.publish2nugetdotorg.bat new file mode 100644 index 0000000..a424415 --- /dev/null +++ b/dist.publish2nugetdotorg.bat @@ -0,0 +1,2 @@ +nuget update /self +for %%f in (.\nupkg\*.nupkg) do nuget push %%f -Source https://www.nuget.org/api/v2/package diff --git a/sign.ps1 b/sign.ps1 new file mode 100644 index 0000000..3bab77d --- /dev/null +++ b/sign.ps1 @@ -0,0 +1,20 @@ +Remove-Item -Path .\*.nupkg +$nuget = ".\nuget.exe" + +if (!(Test-Path $nuget)) +{ + Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile nuget.exe +} + +& $nuget update /self | Write-Debug + +Write-Host "Sign NuGet packages." +& $nuget sign .\nupkg\*.nupkg -CertificateSubjectName "Yang Li" -Timestamper http://timestamp.digicert.com | Write-Debug +& $nuget verify -All .\nupkg\*.nupkg | Write-Debug +if ($LASTEXITCODE -ne 0) +{ + Write-Host "NuGet package is not signed. Exit." + exit $LASTEXITCODE +} + +Write-Host "Verification finished."