Build Flet Windows App #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Flet Windows App | |
| on: | |
| workflow_dispatch: # 仅手动触发 | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| # 1. 拉取代码 | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # 2. 设置 Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| # 3. 安装依赖 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flet pyinstaller | |
| # 4. 安装 Flutter(flet build 需要) | |
| - name: Install Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.29.2' # 建议和本地一致 | |
| channel: stable | |
| # 5. 打包 Windows 应用(禁用 Rich Unicode 输出) | |
| - name: Build Windows app | |
| run: | | |
| chcp 65001 | |
| set PYTHONIOENCODING=utf-8 | |
| flet build windows --no-color | |
| # 6. 上传打包结果(可下载) | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: dist/** |