Skip to content

Commit

Permalink
Add support for azure trusted signing
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Sep 9, 2024
1 parent ea74c06 commit d079004
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
15 changes: 8 additions & 7 deletions Builders/WindowsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ public class WindowsBuilder : Builder
private const string os_name = "win";
private const string channel = "win";

private readonly string? codeSigningPassword;

public WindowsBuilder(string version, string? codeSigningPassword)
public WindowsBuilder(string version)
: base(version)
{
if (!string.IsNullOrEmpty(Program.WindowsCodeSigningCertPath))
this.codeSigningPassword = codeSigningPassword ?? Program.ReadLineMasked("Enter code signing password: ");
}

protected override string TargetFramework => "net8.0";
Expand All @@ -32,8 +28,13 @@ public override Uploader CreateUploader()
+ $" --icon=\"{installIcon}\""
+ $" --noPortable";

if (!string.IsNullOrEmpty(Program.WindowsCodeSigningCertPath))
extraArgs += $" --signParams=\"/td sha256 /fd sha256 /f {Path.GetFullPath(Program.WindowsCodeSigningCertPath)} /p {codeSigningPassword} /tr http://timestamp.comodoca.com\"";
if (!string.IsNullOrEmpty(Program.WindowsCodeSigningMetadataPath))
{
// TODO: resolve from .nuget (or just include locally...)
string dlibPath = "Azure.CodeSigning.Dlib.dll";

extraArgs += $" --signParams=\"/td sha256 /fd sha256 /dlib {dlibPath} /dmdf {Program.WindowsCodeSigningMetadataPath} /tr http://timestamp.acs.microsoft.com\"";
}

return new WindowsVelopackUploader(app_name, os_name, RuntimeIdentifier, channel, extraArgs: extraArgs);
}
Expand Down
6 changes: 3 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal static class Program
public static string GitHubRepoUrl => $"https://github.com/{GitHubUsername}/{GitHubRepoName}";
public static bool CanGitHub => !string.IsNullOrEmpty(GitHubAccessToken);

public static string? WindowsCodeSigningCertPath => ConfigurationManager.AppSettings["WindowsCodeSigningCertPath"];
public static string? WindowsCodeSigningMetadataPath => ConfigurationManager.AppSettings["WindowsCodeSigningMetadataPath"];
public static string? AndroidCodeSigningCertPath => ConfigurationManager.AppSettings["AndroidCodeSigningCertPath"];
public static string? AppleCodeSignCertName => ConfigurationManager.AppSettings["AppleCodeSignCertName"];
public static string? AppleInstallSignCertName => ConfigurationManager.AppSettings["AppleInstallSignCertName"];
Expand Down Expand Up @@ -99,7 +99,7 @@ public static void Main(string[] args)

Console.ResetColor();
Console.WriteLine($"Increment Version: {IncrementVersion}");
Console.WriteLine($"Signing Certificate: {WindowsCodeSigningCertPath}");
Console.WriteLine($"Signing Certificate: {WindowsCodeSigningMetadataPath}");
Console.WriteLine($"Upload to GitHub: {GitHubUpload}");
Console.WriteLine();
Console.Write($"Ready to deploy version {version} on platform {targetPlatform}!");
Expand All @@ -113,7 +113,7 @@ public static void Main(string[] args)
switch (targetPlatform)
{
case RuntimeInfo.Platform.Windows:
builder = new WindowsBuilder(version, getArg(0));
builder = new WindowsBuilder(version);
break;

case RuntimeInfo.Platform.Linux:
Expand Down
1 change: 1 addition & 0 deletions osu.Desktop.Deploy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.Trusted.Signing.Client" Version="1.0.60" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1130.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
Expand Down

0 comments on commit d079004

Please sign in to comment.