From 0aa0e5c4fb9aee9b1bc868c9d4283b79f73058aa Mon Sep 17 00:00:00 2001 From: Matthieu Houdebine Date: Wed, 12 Feb 2025 12:40:13 +0100 Subject: [PATCH] Generate debug installer for Windows --- .../generate-windows-installer-debug.yml | 54 +++++++++++++++++++ .../workflows/generate-windows-installer.yml | 4 +- .../generate-version-info.py | 9 ++++ .../turing-system-monitor.iss | 2 +- ...g.spec => turing-system-monitor-debug.spec | 0 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/generate-windows-installer-debug.yml rename turing-system-monitor_debug.spec => turing-system-monitor-debug.spec (100%) diff --git a/.github/workflows/generate-windows-installer-debug.yml b/.github/workflows/generate-windows-installer-debug.yml new file mode 100644 index 00000000..029c57b0 --- /dev/null +++ b/.github/workflows/generate-windows-installer-debug.yml @@ -0,0 +1,54 @@ +name: Generate Windows Installer (Debug) + +on: + release: + types: [ published ] + +permissions: + contents: write + +jobs: + generate-windows-installer: + name: Generate Windows Installer (Debug) + runs-on: windows-latest + + steps: + - name: Git Checkout ${{github.event.release.tag_name}} + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + + - name: Set version number for PyInstaller + run: | + python.exe tools\windows-installer\generate-version-info.py ${{github.event.release.tag_name}} debug + + - name: Run PyInstaller to create binaries + run: | + pyinstaller.exe --noconfirm turing-system-monitor-debug.spec + + - name: Create InnoSetup installer from generated binaries + uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 + with: + path: tools/windows-installer/turing-system-monitor.iss + options: /O+ + + - name: '📦 Archive Windows installer' + uses: actions/upload-artifact@v4 + with: + name: turing-system-monitor_${{github.event.release.tag_name}} + path: tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}-debug.exe + if-no-files-found: error + + - name: '📩 Publish Windows installer to Release' + run: | + gh release upload ${{github.event.release.tag_name}} tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}-debug.exe + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/generate-windows-installer.yml b/.github/workflows/generate-windows-installer.yml index 8ad70074..5b40b675 100644 --- a/.github/workflows/generate-windows-installer.yml +++ b/.github/workflows/generate-windows-installer.yml @@ -44,11 +44,11 @@ jobs: uses: actions/upload-artifact@v4 with: name: turing-system-monitor_${{github.event.release.tag_name}} - path: tools\windows-installer\Output\turing-system-monitor_${{github.event.release.tag_name}}.exe + path: tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}.exe if-no-files-found: error - name: '📩 Publish Windows installer to Release' run: | - gh release upload ${{github.event.release.tag_name}} tools\windows-installer\Output\turing-system-monitor_${{github.event.release.tag_name}}.exe + gh release upload ${{github.event.release.tag_name}} tools\windows-installer\Output\turing-system-monitor-${{github.event.release.tag_name}}.exe env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/tools/windows-installer/generate-version-info.py b/tools/windows-installer/generate-version-info.py index 4197f67f..b74b20e9 100644 --- a/tools/windows-installer/generate-version-info.py +++ b/tools/windows-installer/generate-version-info.py @@ -39,6 +39,13 @@ revision = int(version[2]) build = 0 # For this project we only use 3-digit versions +if sys.argv[2] == "debug": + print (f"Generating debug version {major}.{minor}.{revision}-debug") + debug_version = True +else: + print (f"Generating version {major}.{minor}.{revision}") + debug_version = False + # Update FixedFileInfo version info.ffi.fileVersionMS = (major << 16) + minor info.ffi.fileVersionLS = (revision << 16) + build @@ -49,6 +56,8 @@ for elem in info.kids[0].kids[0].kids: if elem.name == 'ProductVersion' or elem.name == 'FileVersion': elem.val = f"{major}.{minor}.{revision}" + if debug_version: + elem.val += "-debug" # Update version file with new info, to be used by PyInstaller with codecs.open(VERSION_INFO_FILE, 'w', 'utf-8') as fp: diff --git a/tools/windows-installer/turing-system-monitor.iss b/tools/windows-installer/turing-system-monitor.iss index f6c32185..538a48e2 100644 --- a/tools/windows-installer/turing-system-monitor.iss +++ b/tools/windows-installer/turing-system-monitor.iss @@ -22,7 +22,7 @@ AppSupportURL={#MyAppURL}/wiki AppUpdatesURL={#MyAppURL}/releases DefaultDirName={autopf}\{#MyAppName} DefaultGroupName={#MyAppName} -OutputBaseFilename=turing-system-monitor_{#MyAppVersion} +OutputBaseFilename=turing-system-monitor-{#MyAppVersion} AllowNoIcons=yes PrivilegesRequired=lowest Compression=lzma diff --git a/turing-system-monitor_debug.spec b/turing-system-monitor-debug.spec similarity index 100% rename from turing-system-monitor_debug.spec rename to turing-system-monitor-debug.spec