Skip to content

Build Windows EXE

Build Windows EXE #15

name: Build Windows EXE
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then
pip install -r requirements.txt
else
# Fallback based on README dependencies
pip install customtkinter pillow selenium webdriver-manager undetected-chromedriver browser_cookie3
fi
pip install pyinstaller pillow
- name: Generate .ico from PNG
shell: python
run: |
import os
from PIL import Image
png_path = os.path.join('assets','logo.png')
ico_path = os.path.join('assets','app.ico')
if not os.path.exists(png_path):
raise SystemExit(f"Missing icon PNG at {png_path}")
img = Image.open(png_path).convert('RGBA')
img.save(ico_path, sizes=[(256,256),(128,128),(64,64),(48,48),(32,32),(16,16)])
print('Wrote', ico_path)
- name: Build executable
shell: bash
run: |
pyinstaller --noconfirm --noconsole --clean --onefile \
--name KickDropsMiner \
--icon assets/app.ico \
main.py
- name: Package ZIP for release
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$version = if ($env:GITHUB_REF_NAME) { $env:GITHUB_REF_NAME } else { 'manual' }
$outDir = 'release'
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
$stage = Join-Path $outDir 'stage'
New-Item -ItemType Directory -Force -Path $stage | Out-Null
Copy-Item -Path 'dist/KickDropsMiner.exe' -Destination $stage -Force
if (Test-Path 'config.json') {
Copy-Item 'config.json' -Destination $stage -Force
} else {
Set-Content -Path (Join-Path $stage 'config.json') -Value '{}' -Encoding UTF8
}
foreach ($d in @('chromedriver-win64','locales','assets')) {
if (Test-Path $d) {
Copy-Item -Path $d -Destination (Join-Path $stage $d) -Recurse -Force
}
}
$zipPath = Join-Path $outDir ("KickDropsMiner_${version}.zip")
if (Test-Path $zipPath) { Remove-Item $zipPath -Force }
Compress-Archive -Path (Join-Path $stage '*') -DestinationPath $zipPath
Write-Host "Created $zipPath"
- name: Create GitHub Release and upload asset
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
release/*.zip
generate_release_notes: true