Skip to content

Build EXE (Upload)

Build EXE (Upload) #21

name: Build EXE (Upload)
# This workflow builds a single EXE using PyInstaller on a self-hosted Windows runner.
# It expects a working self-hosted Windows runner with development tools installed
# (Visual C++ Build Tools are commonly required for some packages).
on:
workflow_dispatch:
inputs:
message:
description: Filename (regionerX.XX.py)
required: true
jobs:
build:
# Target self-hosted Windows runner. Adjust labels if your runner uses a different label.
runs-on: [self-hosted]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Verify system Python
run: |
python --version
where.exe python
shell: powershell
- name: Upgrade pip
run: python -m pip install --upgrade pip
shell: powershell
- name: Install dependencies (from requirements.txt if present)
run: |
if (Test-Path requirements.txt) {
Write-Host "Found requirements.txt - installing dependencies"
python -m pip install -r requirements.txt
} else {
Write-Host "No requirements.txt found - installing common runtime deps + pyinstaller"
python -m pip install pyinstaller pillow numpy scipy scikit-image pandas matplotlib
}
shell: powershell
- name: Ensure PyInstaller is installed
run: python -m pip install --upgrade pyinstaller
shell: powershell
- name: Build single-file EXE with PyInstaller
run: |
# Clean previous build outputs if they exist
Remove-Item -Recurse -Force build, dist, __pycache__ -ErrorAction SilentlyContinue
# Adjust the entry script path below if your main script is different
python -m PyInstaller --noconfirm --clean --onefile --uac-admin --name RegionalCounter regioner/${{ github.event.inputs.message }}
# Optionally list the dist folder
Get-ChildItem -Path dist -Recurse
shell: powershell
- name: Upload zipped artifact
uses: actions/upload-artifact@v4
with:
name: RegionalCounter
path: dist/RegionalCounter.exe
retention-days: 1
# - name: Upload full dist folder (zip)
# uses: actions/upload-artifact@v4
# with:
# name: RegionalCounter-dist
# path: dist