BetterCurseForge/.github/workflows/build.yml

65 lines
1.6 KiB
YAML

name: Build Windows Executable
on:
push:
branches:
- master
- main
tags:
- 'v*'
pull_request:
branches:
- master
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build BetterCurseForge.exe
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pyinstaller pillow pywin32
- name: Build executable with PyInstaller
run: |
python -m PyInstaller BetterCurseForge.spec --noconfirm
- name: Verify build output
run: |
if (-not (Test-Path "dist/BetterCurseForge.exe")) {
Write-Error "dist/BetterCurseForge.exe was not created!"
exit 1
}
Get-Item "dist/BetterCurseForge.exe" | Select-Object Name, Length, LastWriteTime
- name: Upload executable artifact
uses: actions/upload-artifact@v4
with:
name: BetterCurseForge-Windows
path: dist/BetterCurseForge.exe
if-no-files-found: error
retention-days: 30
- name: Attach executable to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: dist/BetterCurseForge.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}