Skip to content

Commit

Permalink
Merge pull request #9 from atomex-me/feat/windows-installer
Browse files Browse the repository at this point in the history
Feat/windows installer
  • Loading branch information
k-karuna authored Sep 14, 2021
2 parents 0767349 + de3f9fd commit dabf685
Show file tree
Hide file tree
Showing 19 changed files with 572 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
name: Build and Sign macOS
name: Build and release Windows & MacOS

on:
push:
tags:
- '*.*.*'
- '*.*.*'

jobs:
macos:
build_win:
runs-on: windows-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@master
with:
submodules: true
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Restore NuGet Packages
run: nuget restore Atomex.Client.Desktop.sln
- name: Build
run: MSBuild Atomex.Client.Desktop.Installer/Atomex.Client.Desktop.Installer.wixproj /p:Configuration=Release /p:RuntimeIdentifiers=win-x64 /clp:ErrorsOnly
- name: Upload windows release artifacts
uses: actions/upload-artifact@v2
with:
name: atomex-win
path: Atomex.Client.Desktop.Installer/Installs

build_macos:
runs-on: macos-latest
needs: [build_win]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -31,21 +55,34 @@ jobs:
security unlock-keychain -p $MACOS_CERTIFICATE_PWD atomex.build.keychain
security import certificate.p12 -k atomex.build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CERTIFICATE_PWD atomex.build.keychain
echo 'VER='$(xmllint --xpath "//Project/PropertyGroup/Version/text()" Atomex.Client.Desktop.csproj) >> $GITHUB_ENV
echo 'VER='$(xmllint --xpath "/*[local-name() = 'Project']/*[local-name() = 'PropertyGroup']/*[local-name() = 'Version']/text()" Atomex.Client.Desktop.csproj) >> $GITHUB_ENV
- name: Run Macos build bash script
env:
MACOS_NOTARIZE_PWD: ${{ secrets.MACOS_NOTARIZE_PWD }}
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
SPARKLE_PUBLIC_KEY: ${{ secrets.SPARKLE_PUBLIC_KEY }}
VER: ${{ env.VER }}
run: |
npm install --global create-dmg
./build_osx.sh $MACOS_NOTARIZE_PWD
- name: Download Windows articact files
uses: actions/download-artifact@v2
with:
name: atomex-win
path: dist/

- name: Create appcast file for Windows .msi installer
env:
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
SPARKLE_PUBLIC_KEY: ${{ secrets.SPARKLE_PUBLIC_KEY }}
VER: ${{ env.VER }}
run: ./create_msi_appcast.sh

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "${{ env.VER }}"
automatic_release_tag: "${{ env.VER }}"
prerelease: false
files: dist_osx/*
files: dist/*
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
.vs/

bin/
Installs/
obj/

*.user
dist_osx/
dist/
release/

.DS_Store
Binary file removed Assets/avalonia-logo.ico
Binary file not shown.
93 changes: 93 additions & 0 deletions Atomex.Client.Desktop.Installer/Assets/terms.rtf

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>{d4058b88-9cbc-47e1-bff7-c6a53703eb6e}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Atomex.Client</OutputName>
<OutputType>Package</OutputType>
<DefineSolutionProperties>false</DefineSolutionProperties>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
<HarvestDirectory Include="..\bin\$(Configuration)\net5.0\win-$(Platform)\publish">
<GenerateGuidsNow>true</GenerateGuidsNow>
<DirectoryRefId>INSTALLDIR</DirectoryRefId>
<ComponentGroupName>App</ComponentGroupName>
<PreprocessorVariable>var.BasePath</PreprocessorVariable>
<SuppressCom>true</SuppressCom>
<SuppressRegistry>true</SuppressRegistry>
<SuppressRootDirectory>true</SuppressRootDirectory>
<Link>$(Configuration)</Link>
</HarvestDirectory>
<WixExtension Include="WixUIExtension">
<HintPath>WixUIExtension</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
<WixExtension Include="WixNetFxExtension">
<HintPath>WixNetFxExtension</HintPath>
<Name>WixNetFxExtension</Name>
</WixExtension>
<WixExtension Include="WixUtilExtension">
<HintPath>WixUtilExtension</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Atomex.Client.Desktop.csproj">
<Name>Atomex.Client.Desktop</Name>
<Project>{c1323e2c-7de2-4d2b-a5ff-72590f809842}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>
</RefProjectOutputGroups>
<RefTargetDir>INSTALLDIR</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
<Target Name="BeforeBuild">
<Exec Command="rd /s /q ..\bin\$(Configuration)\net5.0\win-$(Platform)" />
<Exec Command="dotnet publish ..\Atomex.Client.Desktop.csproj -c $(Configuration) -r win-$(Platform)" />
<GetAssemblyIdentity AssemblyFiles="..\bin\$(Configuration)\net5.0\win-$(Platform)\Atomex.Client.Desktop.dll">
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
</GetAssemblyIdentity>
<PropertyGroup>
<DefineConstants>BuildVersion=%(AssemblyVersion.Version);BasePath=..\bin\$(Configuration)\net5.0\win-$(Platform)\publish</DefineConstants>
</PropertyGroup>
</Target>
<Target Name="AfterBuild">
<GetAssemblyIdentity AssemblyFiles="..\bin\$(Configuration)\net5.0\win-$(Platform)\Atomex.Client.Desktop.dll">
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
</GetAssemblyIdentity>

<!-- Rename and move final MSI -->
<Exec Command="if not exist Installs mkdir Installs" />
<Exec Command="move bin\$(Configuration)\$(OutputName).msi Installs\Atomex.Client-%(AssemblyVersion.Version)-$(Platform).msi" />
</Target>
<!-- <PropertyGroup>-->
<!-- <PreBuildEvent>if $(ConfigurationName) == Release start /wait "Atomex binaries signing" exsigner.exe sign -k $(SolutionDir)certificate_key.pfx -s "Atomex Client" $(SolutionDir)Atomex.Client.Desktop\bin\Release\Atomex.Client.Desktop.exe $(SolutionDir)Atomex.Client.Desktop\bin\Release\Atomex.Client.Core.dll</PreBuildEvent>-->
<!-- </PropertyGroup>-->
<!-- <PropertyGroup>-->
<!-- <PostBuildEvent>if $(ConfigurationName) == Release start /wait "Atomex msi signing" exsigner.exe sign -k $(SolutionDir)certificate_key.pfx -s "Atomex Client" !(TargetPath)</PostBuildEvent>-->
<!-- </PropertyGroup>-->
</Project>
125 changes: 125 additions & 0 deletions Atomex.Client.Desktop.Installer/Product.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>

<?define Name = "Atomex Client" ?>
<?define Manufacturer = "Atomex.me" ?>
<?define Description = "Multicurrency HD wallet with built-in hybrid exchange based on atomic swap." ?>
<?define UpgradeCode = "2938733e-4104-443a-850b-3916f1f68430" ?>
<?define ExeName = "Atomex.Client.Desktop.exe" ?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*"
Language="1033"
Name="$(var.Name)"
Version="$(var.BuildVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)"
Codepage="1252"
>

<Package InstallerVersion="400" Compressed="yes" Manufacturer="$(var.Manufacturer)"
Description="$(var.Description)" Comments="Copyright © 2021 Atomex OÜ"
InstallPrivileges="limited" InstallScope="perUser" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />

<Icon Id="AppIcon.exe" SourceFile="$(var.Atomex.Client.Desktop.ProjectDir)\Resources\Images\logo_dark_256x256.ico" />

<Property Id="ARPPRODUCTICON" Value="AppIcon.exe" />
<Property Id="ARPHELPLINK" Value="https://atomex.me/" />
<Property Id="ALLUSERS" Secure="yes" Value="2" />
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />

<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize" />

<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message="Please install .NET Framework 4.5">
<![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>

<Condition Message="Windows 7 or higer is required">
<![CDATA[Installed OR VersionNT >= 601]]>
</Condition>

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="AppRootDirectory" Name="$(var.Manufacturer)">
<Directory Id="INSTALLDIR" Name="$(var.Name)" />
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.Manufacturer)" />
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>

<!-- Start menu shortcut -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="*">
<Shortcut
Id="ApplicationStartMenuShortcut"
Name="$(var.Name)"
Description="$(var.Description)"
Target="[INSTALLDIR]Atomex.Client.Desktop.exe"
WorkingDirectory="INSTALLDIR" />
<RemoveFolder
Id="ApplicationProgramsFolder"
On="uninstall" />
<RegistryValue
Root="HKCU"
Key="Software\$(var.Manufacturer)\$(var.Name)"
Name="installed1"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>

<!-- Desktop shortcut -->
<DirectoryRef Id="DesktopFolder">
<Component Id="ApplicationShortcutDesktop" Guid="*">
<Shortcut
Id="ApplicationDesktopShortcut"
Name="$(var.Name)"
Description="$(var.Description)"
Target="[INSTALLDIR]Atomex.Client.Desktop.exe"
WorkingDirectory="INSTALLDIR" />
<RemoveFolder
Id="DesktopFolder"
On="uninstall" />
<RegistryValue
Root="HKCU"
Key="Software\$(var.Manufacturer)\$(var.Name)"
Name="installed2"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>

<Feature Id="App" Title="$(var.Name)" Level="1">
<ComponentGroupRef Id="App" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
</Feature>

<UI>
<UIRef Id="WixUI_Minimal" />
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>

<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch Atomex Client" />

<Property Id="WixShellExecTarget" Value="[INSTALLDIR]Atomex.Client.Desktop.exe" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />

<WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)\Assets\terms.rtf" />
</Product>
</Wix>
15 changes: 5 additions & 10 deletions Atomex.Client.Desktop.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
<DefaultItemExcludes>$(DefaultItemExcludes);atomex.client.core\**</DefaultItemExcludes>
<UseAppHost>true</UseAppHost>
<RuntimeIdentifiers>osx-x64</RuntimeIdentifiers>

<ApplicationIcon>Resources/Images/logo_dark_256x256.ico</ApplicationIcon>

<AssemblyVersion>1.1.2</AssemblyVersion>
<Version>1.1.2</Version>
Expand All @@ -24,8 +25,8 @@
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.6" />
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.6.10" />
<PackageReference Include="Deadpikle.AvaloniaProgressRing" Version="0.9.0" />
<PackageReference Include="NetSparkleUpdater.SparkleUpdater" Version="2.0.5" />
<PackageReference Include="NetSparkleUpdater.UI.Avalonia" Version="2.0.6" />
<PackageReference Include="NetSparkleUpdater.SparkleUpdater" Version="2.0.7" />
<PackageReference Include="NetSparkleUpdater.UI.Avalonia" Version="2.0.8" />
<PackageReference Include="OxyPlot.Avalonia" Version="2.1.0-20201211.2" />
<PackageReference Include="QRCoder" Version="1.4.1" />
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="5.8.64" />
Expand Down Expand Up @@ -180,10 +181,4 @@
<GlobalPropertiesToRemove></GlobalPropertiesToRemove>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="dist_osx" />
</ItemGroup>
<ItemGroup>
<Content Include=".github\workflows\build_mac.yml" />
</ItemGroup>
</Project>
Loading

0 comments on commit dabf685

Please sign in to comment.