Skip to content

Commit

Permalink
fix #104 & fix installer script version number
Browse files Browse the repository at this point in the history
  • Loading branch information
radj307 committed Oct 29, 2023
1 parent 908c69d commit fb0992a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/GenerateRelease-csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- uses: actions/checkout@v4
with:
ref: '${{ github.ref }}'
fetch-depth: 0

- uses: actions/setup-dotnet@main
with:
Expand All @@ -40,10 +39,7 @@ jobs:
run: foreach($file in $((dir "publish" | where {$_.extension -in ".exe"}).Fullname)){ mv "$file" "STAGING" }

- name: Prepare Installer Prerequisites
id: InitInstaller
run: |
echo AppVersion="$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT"
git clone https://github.com/DomGries/InnoDependencyInstaller
run: git clone https://github.com/DomGries/InnoDependencyInstaller

- name: Build VolumeControl Binary (Installer Version)
run: dotnet publish VolumeControl -c Release-ForInstaller -p:PublishProfile="VolumeControl/Properties/PublishProfiles/PublishForInstaller.pubxml"
Expand All @@ -52,7 +48,7 @@ jobs:
uses: Minionguyjpro/[email protected]
with:
path: vcsetup.iss
options: /dAppVersion="${{ steps.InitInstaller.outputs.AppVersion }}" /Opublish
options: /Opublish

- name: Stage Installer
run: foreach($file in $((dir "publish" | where {$_.extension -in ".exe"}).Fullname)){ mv "$file" "STAGING" }
Expand Down
24 changes: 14 additions & 10 deletions vcsetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
; - AppVersion must be defined on the commandline with /dAppVersion=""

#define public Dependency_Path_NetCoreCheck "InnoDependencyInstaller\dependencies\"
#include "InnoDependencyInstaller\CodeDependencies.iss"
#include "InnoDependencyInstaller\CodeDependencies.iss"

#define SourceExeFilePath "publish\installer"

#define AppID "{33DFCEE8-022C-4C66-A366-79A7415320F2}"
#define AppName "Volume Control"
Expand All @@ -13,8 +15,8 @@
#define AppURL "https://github.com/radj307/volume-control"
#define AppExeName "VolumeControl.exe"
#define AppMutex "VolumeControlSingleInstance"

#define SourceExeFilePath "publish\installer"
#define AppFileVersion GetStringFileInfo(SourceExeFilePath + "\" + AppExeName, "FileVersion")
#define AppVersion GetStringFileInfo(SourceExeFilePath + "\" + AppExeName, "ProductVersion")

[Setup]
AppId={{#AppID}
Expand All @@ -29,6 +31,7 @@ AppUpdatesURL={#AppURL}

VersionInfoDescription={#AppName} installer
VersionInfoProductName={#AppName}
VersionInfoVersion={#AppFileVersion}

UninstallDisplayIcon={app}\{#AppExeName}
UninstallDisplayName={#AppName}
Expand Down Expand Up @@ -79,19 +82,18 @@ Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(
[UninstallDelete]
Type: dirifempty; Name: "{app}"

[Registry]
; All Users
Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#AppID}_is1"; ValueType: string; ValueName: "DisplayVersion"; ValueData: "{#AppVersion}"; Flags: uninsdeletevalue; Check: IsAdmin
; Current User
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#AppID}_is1"; ValueType: string; ValueName: "DisplayVersion"; ValueData: "{#AppVersion}"; Flags: uninsdeletevalue; Check: not IsAdmin

[Code]
function GetUninstallKey(): String;
begin
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
end;
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstPath := GetUninstallKey();
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Expand Down Expand Up @@ -136,6 +138,8 @@ begin
begin
UnInstallOldVersion();
end;
end else if (CurStep=ssPostInstall) then begin
RegWriteStringValue(HKEY_AUTO, GetUninstallKey(), 'DisplayVersion', '{#emit SetupSetting('AppVersion')}');
end;
end;
Expand Down

0 comments on commit fb0992a

Please sign in to comment.