[Skip CI] Sign msi
MODIFY
WalletWasabi.Packager/Program.cs
WalletWasabi.Packager/Program.cs
@@ -13,19 +13,28 @@ namespace WalletWasabi.Packager
{
private static void Main(string[] args)
{
+ // 0. Dump Client version (or else wrong .msi will be created) - Helpers.Constants.ClientVersion
+ // 1. Publish with Packager.
+ // 2. Build WIX project with Release and x64 configuration.
+ // 3. Sign with Packager.
+ bool doPublish = true;
+ bool doSign = false;
+
string packagerProjectDirectory = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..\\..\\..\\"));
string solutionDirectory = Path.GetFullPath(Path.Combine(packagerProjectDirectory, "..\\"));
string guiProjectDirectory = Path.GetFullPath(Path.Combine(solutionDirectory, "WalletWasabi.Gui\\"));
string wixProjectDirectory = Path.GetFullPath(Path.Combine(solutionDirectory, "WalletWasabi.WindowsInstaller\\"));
string binDistDirectory = Path.GetFullPath(Path.Combine(guiProjectDirectory, "bin\\dist"));
+ string finalDirectory = Path.GetFullPath(Path.Combine(binDistDirectory, "final"));
Console.WriteLine($"{nameof(solutionDirectory)}:\t\t{solutionDirectory}");
Console.WriteLine($"{nameof(packagerProjectDirectory)}:\t{packagerProjectDirectory}");
Console.WriteLine($"{nameof(guiProjectDirectory)}:\t\t{guiProjectDirectory}");
Console.WriteLine($"{nameof(wixProjectDirectory)}:\t\t{wixProjectDirectory}");
Console.WriteLine($"{nameof(binDistDirectory)}:\t\t{binDistDirectory}");
+ Console.WriteLine($"{nameof(finalDirectory)}:\t\t{finalDirectory}");
- string executableName = "Wasabi Wallet";
string versionPrefix = Helpers.Constants.ClientVersion.ToString();
+ string executableName = "Wasabi Wallet";
Console.WriteLine();
Console.WriteLine($"{nameof(versionPrefix)}:\t\t\t{versionPrefix}");
Console.WriteLine($"{nameof(executableName)}:\t\t\t{executableName}");
@@ -36,6 +45,7 @@ namespace WalletWasabi.Packager
// .NET Core - win-32, linux-64, osx-64
// Avalonia - win7-32, linux-64, osx-64
// We'll only support x64, if someone complains, we can come back to it.
+ // For 32 bit Windows there needs to be a lot of WIX configuration to be done.
var targets = new List<string>
{
"win7-x64",
@@ -57,6 +67,8 @@ namespace WalletWasabi.Packager
});
Console.WriteLine();
+ if (doPublish)
+ {
var psiBuild = new ProcessStartInfo
{
FileName = "cmd",
@@ -155,40 +167,46 @@ namespace WalletWasabi.Packager
"It matters on Windows. It may or may not make a difference in Linux and OSX.";
IoHelpers.EnsureContainingDirectoryExists(dummyFilePath);
File.WriteAllText(dummyFilePath, dummyFileContent);
+ }
+ }
+ Directory.CreateDirectory(finalDirectory);
+ if (doSign is true)
+ {
+ foreach (string target in targets)
+ {
if (target.StartsWith("win", StringComparison.OrdinalIgnoreCase))
{
- //// Create msi.
- //var wixToolsDir = @"C:\Program Files (x86)\WiX Toolset v3.11\bin\";
- //var psiHeat = new ProcessStartInfo
- //{
- // FileName = $@"{wixToolsDir}Heat.exe",
- // Arguments = $@"dir {currentBinDistDirectory} -cg PublishedComponents -dr INSTALLFOLDER -scom -sreg -srd -var var.BasePath -gg -sfrag -out ComponentsGenerated.wxs",
- // WorkingDirectory = wixProjectDirectory
- //};
- //var pHeat = Process.Start(psiHeat);
- //pHeat.WaitForExit();
-
- //var psiCandle = new ProcessStartInfo
- //{
- // FileName = $@"{wixToolsDir}candle.exe", // This lower case is not a typo.
- // Arguments = $"-dBuildVersion=0.9.1.0 -dBasePath={currentBinDistDirectory} -d\"\\DevEnvDir = C:\\Program Files(x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\\\\" -dSolutionDir={solutionDirectory} -dSolutionExt=.sln -dSolutionFileName=WalletWasabi.sln -dSolutionName=WalletWasabi -dSolutionPath={solutionDirectory}\\WalletWasabi.sln -dConfiguration=Release -dOutDir={binDistDirectory} -dPlatform=x64 -dProjectDir={wixProjectDirectory} -dProjectExt=.wixproj -dProjectFileName=WalletWasabi.WindowsInstaller.wixproj -dProjectName=WalletWasabi.WindowsInstaller -dProjectPath={wixProjectDirectory}\\WalletWasabi.WindowsInstaller.wixproj -dTargetDir={binDistDirectory} -dTargetExt=.msi -dTargetFileName=WasabiInstaller.msi -dTargetName=WasabiInstaller -dTargetPath={binDistDirectory}\\WasabiInstaller.msi",
- // WorkingDirectory = wixProjectDirectory
- //};
- //var pCandle = Process.Start(psiCandle);
- //pCandle.WaitForExit();
-
- //var psiLight = new ProcessStartInfo
- //{
- // FileName = $@"{wixToolsDir}Light.exe",
- // Arguments = $"publish --configuration Release --force --output {currentBinDistDirectory} --self-contained true --runtime {target} /p:VersionPrefix={versionPrefix} --disable-parallel --no-cache",
- // WorkingDirectory = wixProjectDirectory
- //};
- //var pLight = Process.Start(psiLight);
- //pLight.WaitForExit();
+ Console.WriteLine("Move created .msi");
+ var msiPath = Path.Combine(wixProjectDirectory, @"bin\Release\WasabiInstaller.msi");
+ if (!File.Exists(msiPath))
+ {
+ throw new Exception(".msi doesn't exist. Expected path: WasabiInstaller.msi.");
+ }
+ var msiFileName = Path.GetFileName(msiPath);
+ var newMsiPath = Path.Combine(finalDirectory, msiFileName);
+ File.Move(msiPath, newMsiPath);
}
}
+ Console.WriteLine("Signing final files...");
+ var finalFiles = Directory.GetFiles(finalDirectory);
+
+ foreach (var finalFile in finalFiles)
+ {
+ var psiSignProcess = new ProcessStartInfo
+ {
+ FileName = "cmd",
+ RedirectStandardInput = true,
+ WorkingDirectory = finalDirectory
+ };
+ var signProcess = Process.Start(psiSignProcess);
+ signProcess.StandardInput.WriteLine($"gpg --armor --detach-sign {finalFile} && exit");
+ signProcess.WaitForExit();
+ }
+ }
+
+
Console.WriteLine();
Console.WriteLine("FINISHED! Press key to exit...");
Console.ReadKey();

[Skip CI] Sign msi