diff --git a/SignPackages.ps1 b/SignPackages.ps1 deleted file mode 100644 index d73ffe5bc1..0000000000 --- a/SignPackages.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -$currentDirectory = split-path $MyInvocation.MyCommand.Definition - -# See if we have the ClientSecret available -if([string]::IsNullOrWhitespace($env:SIGNCLIENT_SECRET)){ - Write-Error "Client Secret not found, not signing packages"; - [System.Environment]::Exit(1); -} - -dotnet tool install --tool-path . SignClient - -# Setup Variables we need to pass into the sign client tool -$appSettings = "$currentDirectory\SignPackages.json" - -$nupgks = gci $Env:ArtifactDirectory\packages\*.nupkg | Select -ExpandProperty FullName - -foreach ($nupkg in $nupgks){ - Write-Host "Submitting $nupkg for signing" - - .\SignClient 'sign' -c $appSettings -i $nupkg -r $env:SIGNCLIENT_USER -s $env:SIGNCLIENT_SECRET -n 'ReactiveUI' -d 'ReactiveUI' -u 'https://reactiveui.net' - - Write-Host "Finished signing $nupkg" -} - -Write-Host "Sign-package complete" \ No newline at end of file diff --git a/build.cake b/build.cake index 8f257f499a..cd2e85c89d 100644 --- a/build.cake +++ b/build.cake @@ -12,6 +12,12 @@ #addin "nuget:?package=Cake.Powershell&version=0.4.7" #addin "nuget:?package=Cake.Codecov&version=0.5.0" +////////////////////////////////////////////////////////////////////// +// MODULES +////////////////////////////////////////////////////////////////////// + +#module nuget:?package=Cake.DotNetTool.Module&version=0.1.0 + ////////////////////////////////////////////////////////////////////// // TOOLS ////////////////////////////////////////////////////////////////////// @@ -23,6 +29,12 @@ #tool "nuget:?package=xunit.runner.console&version=2.4.1" #tool "nuget:?package=Codecov&version=1.1.0" +////////////////////////////////////////////////////////////////////// +// DOTNET TOOLS +////////////////////////////////////////////////////////////////////// + +#tool "dotnet:?package=SignClient&version=1.0.82" + ////////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// @@ -319,9 +331,32 @@ Task("SignPackages") .WithCriteria(() => !isPullRequest) .Does(() => { - StartPowershellFile("./SignPackages.ps1", args => + if(EnvironmentVariable("SIGNCLIENT_SECRET") == null) + { + throw new Exception("Client Secret not found, not signing packages."); + } + + var nupkgs = GetFiles(packagesArtifactDirectory + "/*.nupkg"); + foreach(FilePath nupkg in nupkgs) { - }); + var packageName = nupkg.GetFilenameWithoutExtension(); + Information($"Submitting {packageName} for signing"); + + DotNetCoreTool("SignClient", new DotNetCoreToolSettings{ + ArgumentCustomization = args => + args.AppendSwitch("-c", "./SignPackages.json") + .AppendSwitch("-i", nupkg.FullPath) + .AppendSwitch("-r", EnvironmentVariable("SIGNCLIENT_USER")) + .AppendSwitch("-s", EnvironmentVariable("SIGNCLIENT_SECRET")) + .AppendSwitch("-n", "ReactiveUI") + .AppendSwitch("-d", "ReactiveUI") + .AppendSwitch("-u", "https://reactiveui.net") + }); + + Information($"Finished signing {packageName}"); + } + + Information("Sign-package complete"); }); Task("Package") diff --git a/build.ps1 b/build.ps1 index 7f4bb76e18..27e6ef945f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -225,5 +225,6 @@ $cakeArguments += $ScriptArgs # Start Cake Write-Host "Running build script..." +&$CAKE_EXE --bootstrap &$CAKE_EXE $cakeArguments exit $LASTEXITCODE \ No newline at end of file