Skip to content

Commit

Permalink
Add version number to the MSI.
Browse files Browse the repository at this point in the history
* Bump the project version to 2.2.0.
  • Loading branch information
dima-iholkin committed Aug 20, 2024
1 parent 6da886c commit 9d0387d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/github-actions-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ jobs:
run: |
.\src\Installer\_scripts\build_all_installers.ps1
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
- name: Upload files to a GitHub release
uses: svenstaro/upload-release-action@2.9.0
with:
name: my-artifact
path: src/Installer/_build/SwitchApps*
file: src/Installer/_build/SwitchApps*
file_glob: true
draft: true
release_name: debug
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:2.1.1"
"ProductVersion" = "8:2.2.0"
"Manufacturer" = "8:Dima Iholkin"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:/~https://github.com/dima-iholkin/SwitchApps"
Expand Down
30 changes: 22 additions & 8 deletions src/Installer/_scripts/_helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ function BuildAllInstallers {
DisableOutOfProcBuild
# Choose the AHK "Compiler" directory path:
$ahkCompilerPath = GetAhkCompilerPath
# Parse the project version:
$version = ParseProjectVersion
# Build the executables and installers:
SetProjectFileToPlatform -Platform x64
BuildExeAndInstaller -Platform x64 -Mod Normal -AhkCompilerPath $ahkCompilerPath
BuildExeAndInstaller -Platform x64 -Mod AppGroupingMod -AhkCompilerPath $ahkCompilerPath
BuildExeAndInstaller -Platform x64 -Mod Normal -AhkCompilerPath $ahkCompilerPath -Version $version
BuildExeAndInstaller -Platform x64 -Mod AppGroupingMod -AhkCompilerPath $ahkCompilerPath -Version $version
SetProjectFileToPlatform -Platform x86
BuildExeAndInstaller -Platform x86 -Mod Normal -AhkCompilerPath $ahkCompilerPath
BuildExeAndInstaller -Platform x86 -Mod AppGroupingMod -AhkCompilerPath $ahkCompilerPath
BuildExeAndInstaller -Platform x86 -Mod Normal -AhkCompilerPath $ahkCompilerPath -Version $version
BuildExeAndInstaller -Platform x86 -Mod AppGroupingMod -AhkCompilerPath $ahkCompilerPath -Version $version
SetProjectFileToPlatform -Platform x64
}

Expand Down Expand Up @@ -98,7 +100,8 @@ function BuildInstaller {
param (
[Parameter()]
[Platform] $Platform,
[Mod] $Mod
[Mod] $Mod,
[String] $Version
)
# Set the paths for build:
$scriptsDir = $PSScriptRoot # src\Installer\_scripts
Expand Down Expand Up @@ -130,7 +133,7 @@ function BuildInstaller {
Default { throw "Unexpected mod argument." }
}
# Copy the installer file to the "build" directory:
Copy-Item -Path $installerFile -Destination ($buildDir + "\SwitchApps" + $installerPlatform + $installerMod + ".msi") -Force
Copy-Item -Path $installerFile -Destination ($buildDir + "\SwitchApps" + $installerPlatform + $installerMod + "-v" + $Version + ".msi") -Force
}

function BuildExeAndInstaller {
Expand All @@ -139,10 +142,11 @@ function BuildExeAndInstaller {
[Parameter()]
[Platform] $Platform,
[Mod] $Mod,
[String] $AhkCompilerPath
[String] $AhkCompilerPath,
[String] $Version
)
BuildExe -Platform $Platform -Mod $Mod -AhkCompilerPath $AhkCompilerPath
BuildInstaller -Platform $Platform -Mod $Mod
BuildInstaller -Platform $Platform -Mod $Mod -Version $Version
}

function DisableOutOfProcBuild() {
Expand Down Expand Up @@ -217,6 +221,16 @@ function SetProjectFileToPlatform {
}
}

function ParseProjectVersion {
# Set the paths:
$scriptsDir = $PSScriptRoot # src\Installer\_scripts
$installerDir = Split-Path -Path $scriptsDir -Parent # src\Installer
$projectFile = $installerDir + "\SwitchApps_Installer\SwitchApps_Installer.vdproj" # src\Installer\SwitchApps_Installer\SwitchApps_Installer.vdproj
# Parse the version from project file:
$fileContents = Select-String -Path $projectFile -Pattern '"ProductVersion" = "8:' -SimpleMatch
return $fileContents.Line.Replace('"ProductVersion" = "8:', "").Replace('"', '').Trim()
}

# Enums:

enum Platform {
Expand Down

0 comments on commit 9d0387d

Please sign in to comment.