Skip to content

feat: Add auto-run functionality to the Windows app #38

feat: Add auto-run functionality to the Windows app

feat: Add auto-run functionality to the Windows app #38

name: Test Windows Build
on:
workflow_dispatch:
inputs:
debug_mode:
description: 'Enable Debug Mode'
required: false
type: boolean
default: true
pull_request: # Optionally trigger on PRs
jobs:
build_windows_test:
runs-on: windows-latest
defaults:
run:
working-directory: monitor-app
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pillow
- name: Set test version
run: |
$timestamp = [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId((Get-Date), 'Central European Standard Time').ToString("yyyyMMdd-HHmm")
# Read version from src/version.py and append timestamp
$version = (Get-Content src/version.py | Select-String 'VERSION = "(.*)"').Matches.Groups[1].Value
$testVersion = "$version-test-$timestamp"
echo "VERSION=$testVersion" >> $env:GITHUB_ENV
# Update src/version.py with test version
(Get-Content src/version.py) -replace 'VERSION = ".*"', "VERSION = `"$testVersion`"" | Set-Content src/version.py
- name: Build executable
run: |
# Replace the DEBUG_MODE line in the spec file
$debug_value = if (${{ inputs.debug_mode }}) { "True" } else { "False" }
(Get-Content disco_beacon_win_test.spec) -replace 'DEBUG_MODE = (?:True|False)', "DEBUG_MODE = $debug_value" | Set-Content disco_beacon_win_test.spec
pyinstaller --clean disco_beacon_win_test.spec
- name: Upload test artifact
uses: actions/upload-artifact@v4
with:
name: DiscoBeacon_Windows_Test_${{ env.VERSION }}
path: ${{ github.workspace }}/monitor-app/dist/DiscoBeacon.exe
retention-days: 5