feat: Add GitHub Actions workflow to automatically build a Windows executable.
Some checks failed
Build Windows EXE / build (push) Failing after 5s
Some checks failed
Build Windows EXE / build (push) Failing after 5s
This commit is contained in:
36
.github/workflows/build-exe.yml
vendored
36
.github/workflows/build-exe.yml
vendored
@@ -17,26 +17,50 @@ jobs:
|
||||
Write-Host "Workspace: $pwd"
|
||||
Get-ChildItem
|
||||
|
||||
- name: Check Python
|
||||
- name: Locate project files
|
||||
shell: powershell
|
||||
run: |
|
||||
$mainFile = Get-ChildItem -Path $pwd -Recurse -Filter main.py -File | Select-Object -First 1
|
||||
if (-not $mainFile) {
|
||||
Write-Error "Could not find main.py in workspace."
|
||||
}
|
||||
|
||||
$projectDir = $mainFile.Directory.FullName
|
||||
"PROJECT_DIR=$projectDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Write-Host "Project directory: $projectDir"
|
||||
Get-ChildItem $projectDir
|
||||
|
||||
- name: Detect Python
|
||||
shell: powershell
|
||||
run: |
|
||||
if (Get-Command py -ErrorAction SilentlyContinue) {
|
||||
"PY_CMD=py" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
py --version
|
||||
}
|
||||
elseif (Get-Command python -ErrorAction SilentlyContinue) {
|
||||
"PY_CMD=python" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
python --version
|
||||
pip --version
|
||||
}
|
||||
else {
|
||||
Write-Error "Python is not installed or not available in PATH. Install Python on the runner, or add py/python to PATH."
|
||||
}
|
||||
|
||||
- name: Install dependencies
|
||||
shell: powershell
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pyinstaller keyboard pywin32
|
||||
& $env:PY_CMD -m pip --version
|
||||
& $env:PY_CMD -m pip install --upgrade pip
|
||||
& $env:PY_CMD -m pip install pyinstaller keyboard pywin32
|
||||
|
||||
- name: Build executable
|
||||
shell: powershell
|
||||
working-directory: ${{ env.PROJECT_DIR }}
|
||||
run: |
|
||||
pyinstaller --noconfirm --onefile --windowed --name Shortcut_Sync_PotPlayer main.py
|
||||
& $env:PY_CMD -m PyInstaller --noconfirm --onefile --windowed --name Shortcut_Sync_PotPlayer main.py
|
||||
|
||||
- name: Collect build output
|
||||
shell: powershell
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force output | Out-Null
|
||||
Copy-Item dist/Shortcut_Sync_PotPlayer.exe output/Shortcut_Sync_PotPlayer.exe -Force
|
||||
Copy-Item "$env:PROJECT_DIR\\dist\\Shortcut_Sync_PotPlayer.exe" output/Shortcut_Sync_PotPlayer.exe -Force
|
||||
Get-ChildItem output
|
||||
|
||||
Reference in New Issue
Block a user