Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #333 from ernelio/feature/packaging-v2
Browse files Browse the repository at this point in the history
[FEATURE] Path for win bin download
  • Loading branch information
ernelio authored Jul 31, 2020
2 parents ec1864e + 9eb80b1 commit cef606c
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ jobs:
command: |
sudo apt-get update -y
sudo apt-get install -y osslsigncode
osslsigncode sign -pkcs12 packaging/windows/ZupIT.pfx -pass "$SIGN_CODE" -n "Ritchie CLI ZupIT" -h sha256 -t http://timestamp.digicert.com/ -in dist/installer/ritchiecliteamzup.msi -out dist/installer/ritchiecliteamzup.msi
osslsigncode sign -pkcs12 packaging/windows/ZupIT.pfx -pass "$SIGN_CODE" -n "Ritchie CLI ZupIT" -h sha256 -t http://timestamp.digicert.com/ -in dist/installer/ritchiecli.msi -out dist/installer/ritchiecli.msi
- persist_to_workspace:
root: dist
paths:
Expand Down
9 changes: 6 additions & 3 deletions .circleci/scripts/gen-win.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Write-Output 'DOWLOADING GO-MSI INSTALLER'

$url = "https://github.com/mh-cbon/go-msi/releases/download/1.0.2/go-msi-amd64.msi"
Expand Down Expand Up @@ -47,13 +46,17 @@ copy LICENSE packaging/windows

cd packaging\windows

Write-Output 'GENERATING WIX MSI TEMPLATE'

& 'C:\Program Files\go-msi\go-msi.exe' generate-templates --path wix.json --version $release_version --src ritchie-wix-templates --out $release_version

Write-Output 'GENERATING MSI INSTALLER'

& 'C:\Program Files\go-msi\go-msi.exe' make --msi ritchiecli.msi --version $release_version --path wix.json
& 'C:\Program Files\go-msi\go-msi.exe' make --msi ritchiecli.msi --version $release_version --path wix.json --src $release_version

Write-Output 'GENERATING CHOCO INSTALLER'

& 'C:\Program Files\go-msi\go-msi.exe' choco --version $release_version"-ritchie" --input ritchiecli.msi --path wix.json
& 'C:\Program Files\go-msi\go-msi.exe' choco --version $release_version"-ritchie" --input ritchiecli.msi --path wix.json --src $release_version


Write-Output 'COPYING FILES TO THE RIGHT PLACE'
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,17 @@ ifneq "$(IS_BETA)" ""
endif
ifneq "$(IS_RELEASE)" ""
echo -n "$(RELEASE_VERSION)" > stable.txt
mkdir latest
cp dist/installer/ritchiecli.msi latest/
aws s3 sync . s3://$(BUCKET)/ --exclude "*" --include "stable.txt"
aws s3 sync . s3://$(BUCKET)/ --exclude "*" --include "latest/ritchiecli.msi"
endif
ifneq "$(IS_QA)" ""
echo -n "$(RELEASE_VERSION)" > stable.txt
mkdir latest
cp dist/installer/ritchiecli.msi latest/
aws s3 sync . s3://$(BUCKET)/ --exclude "*" --include "stable.txt"
aws s3 sync . s3://$(BUCKET)/ --exclude "*" --include "latest/ritchiecli.msi"
endif
else
echo "NOT GONNA PUBLISH"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ curl -fsSL https://commons-repo.ritchiecli.io/install.sh | bash

- Windows

Download the installer from (https://commons-repo.ritchiecli.io/install.msi)
Download the installer from (https://commons-repo.ritchiecli.io/latest/ritchiecli.msi)

### Initialize rit

Expand Down
Binary file removed packaging/windows/ico.ico
Binary file not shown.
36 changes: 36 additions & 0 deletions packaging/windows/ritchie-wix-templates/LicenseAgreementDlg_HK.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="LicenseAgreementDlg_HK" Width="370" Height="270" Title="!(loc.LicenseAgreementDlg_Title)">
<Control Id="LicenseAcceptedCheckBox" Type="CheckBox" X="20" Y="207" Width="330" Height="18" CheckBoxValue="1" Property="LicenseAccepted"
Text="!(loc.LicenseAgreementDlgLicenseAcceptedCheckBox)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
<Condition Action="disable"><![CDATA[LicenseAccepted <> "1"]]></Condition>
<Condition Action="enable">LicenseAccepted = "1"</Condition>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" />
<Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no">

{{if gt (.License | len) 0}}
<Text SourceFile="C:\workspace\LICENSE" />
{{end}}

</Control>
<Control Id="Print" Type="PushButton" X="112" Y="243" Width="56" Height="17" Text="!(loc.WixUIPrint)">
<Publish Event="DoAction" Value="WixUIPrintEula">1</Publish>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgTitle)" />
</Dialog>
</UI>
</Fragment>
</Wix>
65 changes: 65 additions & 0 deletions packaging/windows/ritchie-wix-templates/WixUI_HK.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>

<UI Id="WixUI_HK">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />

<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />

<!-- Make sure to include custom dialogs in the installer database via a DialogRef command,
especially if they are not included explicitly in the publish chain below -->
<DialogRef Id="LicenseAgreementDlg_HK"/>

<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>

<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
{{if gt (.License | len) 0}}
Value="LicenseAgreementDlg_HK"
{{else}}
Value="InstallDirDlg"
{{end}}
>NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>

<Publish Dialog="LicenseAgreementDlg_HK" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="LicenseAgreementDlg_HK" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAccepted = "1"</Publish>

<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg_HK">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>

<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>

<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
</UI>

<UIRef Id="WixUI_Common" />
</Fragment>
</Wix>
113 changes: 113 additions & 0 deletions packaging/windows/ritchie-wix-templates/product.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0"?>

<?if $(sys.BUILDARCH)="x86"?>
<?define Program_Files="ProgramFilesFolder"?>
<?elseif $(sys.BUILDARCH)="x64"?>
<?define Program_Files="ProgramFiles64Folder"?>
<?else?>
<?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
<?endif?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

<Product Id="*" UpgradeCode="{{.UpgradeCode}}"
Name="{{.Product}}"
Version="{{.VersionOk}}"
Manufacturer="{{.Company}}"
Language="1033">

<Package
InstallerVersion="200"
Compressed="yes"
Comments="Windows Installer Package"
AdminImage="no"
ReadOnly="yes"
InstallScope="perUser"
InstallPrivileges="limited" />

<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>

<Upgrade Id="{{.UpgradeCode}}">
<UpgradeVersion Minimum="{{.VersionOk}}" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/>
<UpgradeVersion Minimum="0.0.0" Maximum="{{.VersionOk}}" IncludeMinimum="yes" IncludeMaximum="no"
Property="OLDERVERSIONBEINGUPGRADED"/>
</Upgrade>
<Condition Message="A newer version of this software is already installed.">NOT NEWERVERSIONDETECTED</Condition>

<!-- Gets the user profile home path i.e: C:\Users\<userName> -->
<SetDirectory Id="USERPROFILEFOLDER" Value="[%USERPROFILE]"/>

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="USERPROFILEFOLDER">
<Directory Id="INSTALLDIR" Name="{{.Product}}">
<Component Id="ApplicationFiles" Guid="{{.Files.GUID}}">
<File Id="ApplicationFile0" Source="C:\workspace\workspace\dist\windows\rit.exe"/>
<RegistryValue Root="HKCU"
Key="Software\{{$.Company}}\{{$.Product}}"
Name="InstallFolder-0"
Value="[INSTALLFOLDER]"
Type="string"
KeyPath="yes"/>
<RemoveFolder Id="USERPROFILEFOLDER" On="uninstall"/>
</Component>
</Directory>
</Directory>

{{if gt (.Env.Vars | len) 0}}
<Component Id="ENVS" Guid="{{.Env.GUID}}">
{{range $i, $e := .Env.Vars}}
<Environment Id="ENV{{$i}}"
Name="{{$e.Name}}"
Value="{{$e.Value}}"
Permanent="{{$e.Permanent}}"
Part="{{$e.Part}}"
Action="{{$e.Action}}"
System="{{$e.System}}" />
{{end}}
</Component>
{{end}}
</Directory>

{{range $i, $e := .InstallHooks}}
<SetProperty Id="CustomInstallExec{{$i}}" Value="{{$e.CookedCommand}}" Before="CustomInstallExec{{$i}}" Sequence="execute"/>
<CustomAction Id="CustomInstallExec{{$i}}" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no"/>
{{end}}
{{range $i, $e := .UninstallHooks}}
<SetProperty Id="CustomUninstallExec{{$i}}" Value="{{$e.CookedCommand}}" Before="CustomUninstallExec{{$i}}" Sequence="execute"/>
<CustomAction Id="CustomUninstallExec{{$i}}" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="check" Impersonate="no"/>
{{end}}
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate"/>
{{range $i, $e := .InstallHooks}}
<Custom Action="CustomInstallExec{{$i}}" After="{{if eq $i 0}}InstallFiles{{else}}CustomInstallExec{{dec $i}}{{end}}">NOT Installed AND NOT REMOVE</Custom>
{{end}}
{{range $i, $e := .UninstallHooks}}
<Custom Action="CustomUninstallExec{{$i}}" After="{{if eq $i 0}}InstallInitialize{{else}}CustomUninstallExec{{dec $i}}{{end}}">REMOVE ~= "ALL"</Custom>
{{end}}
</InstallExecuteSequence>

<Feature Id="DefaultFeature" Level="1">
{{if gt (.Env.Vars | len) 0}}
<ComponentRef Id="ENVS"/>
{{end}}
{{if gt (.Files.Items | len) 0}}
<ComponentRef Id="ApplicationFiles"/>
{{end}}
{{range $i, $e := .Directories}}
<ComponentGroupRef Id="AppFiles{{$i}}" />
{{end}}
</Feature>

<UI>
<!-- Define the installer UI -->
<UIRef Id="WixUI_HK" />
</UI>

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

<!-- this should help to propagate env var changes -->
<CustomActionRef Id="WixBroadcastEnvironmentChange" />

</Product>

</Wix>
4 changes: 1 addition & 3 deletions packaging/windows/wix.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
"name": "ritchiecli",
"description": "Ritchie CLI",
"target": "[INSTALLDIR]\\rit.exe",
"wdir": "INSTALLDIR",
"arguments": "",
"icon": "ico.ico"
"wdir": "INSTALLDIR"
}
]
},
Expand Down

0 comments on commit cef606c

Please sign in to comment.