feat: Add auto-run functionality to the Windows app #32
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
(Get-Content disco_beacon_test.spec) -replace 'DEBUG_MODE = False', 'DEBUG_MODE = ${{ inputs.debug_mode }}' | Set-Content disco_beacon_test.spec | |
pyinstaller --clean disco_beacon_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 |