Files
docutranslate/.github/workflows/build-windows-full.yml
2025-09-24 14:08:50 +08:00

56 lines
1.5 KiB
YAML

name: Build Windows-full Application
on:
workflow_dispatch:
release:
types: [created]
jobs:
build-windows:
runs-on: windows-latest
steps:
# 第 1 步: 检出你的代码
- name: Checkout repository
uses: actions/checkout@v4
# 第 2 步: 设置 Python 环境
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
# 新增步骤: 安装 MSVC v143 - VS 2022 C++ build tools
# 这会安装所有必要的运行时库
- name: Install Microsoft Visual C++ Redistributable
uses: ilammy/msvc-dev-cmd@v1
# 第 3 步: 安装 uv
- name: Install uv
run: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
- name: Add uv to PATH
run: echo "$env:APPDATA\uv\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# 第 4 步: 安装依赖
- name: Install dependencies with uv
run: uv sync
# 第 5 步: 安装 UPX (简化版本)
- name: Install UPX
run: |
choco install upx -y
# 第 6 步: 运行 PyInstaller
- name: Build the application with PyInstaller
run: |
uv pip install pyinstaller
uv run pyinstaller full.spec --noconfirm
# 第 7 步: 上传 exe 文件作为构建产物
- name: Upload Windows executable
uses: actions/upload-artifact@v4
with:
name: DocuTranslate-full-Windows
path: dist/*.exe