Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions sign.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
param(
[Parameter(mandatory=$false)]
[bool]$dryrun=$false,
[bool]$publish=$false,
[Parameter(mandatory=$false)]
[string]$certicate="Open Source Developer, Sarin Na Wangkanai"
[string]$name="Open Source Developer, Sarin Na Wangkanai"
)


Write-Host "NuGet Certificate: $certicate" -ForegroundColor Magenta

Remove-Item -Path .\signed\*.* -Force -ErrorAction SilentlyContinue
Expand All @@ -14,23 +15,23 @@ New-Item -Path artifacts -ItemType Directory -Force | Out-Null
New-Item -Path signed -ItemType Directory -Force | Out-Null

dotnet --version
dotnet clean -c Release -tl
dotnet restore
dotnet build -c Release -tl
dotnet clean .\src\ -c Release -tl
dotnet restore .\src\
dotnet build .\src\ -c Release -tl
Get-ChildItem .\src\ -Recurse Wangkanai.*.dll | where { $_.Directory -like "*Release*" } | foreach {
signtool sign /fd SHA256 /t http://timestamp.digicert.com /n $certicate $_.FullName
signtool sign /fd SHA256 /t http://timestamp.digicert.com /n $name $_.FullName
}

dotnet pack -c Release -tl -o .\artifacts --include-symbols -p:SymbolPackageFormat=snupkg
dotnet pack .\src\ -c Release -tl -o .\artifacts --include-symbols -p:SymbolPackageFormat=snupkg

dotnet nuget sign .\artifacts\*.nupkg -v normal --timestamper http://timestamp.digicert.com --certificate-subject-name $certicate -o .\signed
dotnet nuget sign .\artifacts\*.snupkg -v normal --timestamper http://timestamp.digicert.com --certificate-subject-name $certicate -o .\signed
dotnet nuget sign .\artifacts\*.nupkg -v normal --timestamper http://timestamp.digicert.com --certificate-subject-name $name -o .\signed
dotnet nuget sign .\artifacts\*.snupkg -v normal --timestamper http://timestamp.digicert.com --certificate-subject-name $name -o .\signed

if ($dryrun)
if (!$publish)
{
Write-Host "Dryrun: Cryptography" -ForegroundColor Yellow;
write-host "Skip update: System" -ForegroundColor Yellow;
exit;
}

dotnet nuget push .\signed\*.nupkg --skip-duplicate -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json
dotnet nuget push .\signed\*.nupkg --skip-duplicate -k $env:GITHUB_API_PAT -s https://nuget.pkg.github.com/wangkanai/index.json

Loading