mirror of
https://ghfast.top/https://github.com/aeroxw/easy-tdx.git
synced 2026-09-12 16:54:17 +08:00
v1.19.5 EXE 只有 11MB,双击报 ModuleNotFoundError: No module named 'pandas'。 根因:release.yml 先 pip install -e '.[web,packaging]' 再 Build frontend, 但 force-include 要求 web-ui/dist 在 pip install 时就存在——install 阶段 dist 不存在导致 editable install 静默降级,PyInstaller 收集不到第三方包。 修复:调换步骤顺序,Build frontend 在 Install Python deps 之前。 ci.yml 上一 commit 已同样修复。
95 lines
2.8 KiB
YAML
95 lines
2.8 KiB
YAML
name: Release EXE
|
||
|
||
# 打 tag 时构建 Windows 单 EXE 并发布到 GitHub Release。
|
||
# 与 publish.yml(PyPI)并行独立:即使 PyPI 发布失败,EXE 仍可发布,
|
||
# 提高发布韧性。Phase 1 产物未签名,老人首次运行会被 SmartScreen 拦截,
|
||
# 需手动"更多信息 → 仍要运行"——Phase 2 引入代码签名后解决。
|
||
on:
|
||
push:
|
||
tags:
|
||
- "v*"
|
||
|
||
permissions:
|
||
contents: write # softprops/action-gh-release 创建 Release 需要
|
||
|
||
jobs:
|
||
build-windows:
|
||
name: Build Windows EXE
|
||
runs-on: windows-latest
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
|
||
- name: Set up Python
|
||
uses: actions/setup-python@v5
|
||
with:
|
||
python-version: "3.12"
|
||
|
||
- name: Set up Node
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: "20"
|
||
cache: "npm"
|
||
cache-dependency-path: web-ui/package-lock.json
|
||
|
||
# 构建前端 → web-ui/dist/。必须在 pip install 前:pyproject.toml 的
|
||
# force-include 要求 web-ui/dist 存在,否则 pip install -e . 报错。
|
||
- name: Build frontend
|
||
run: |
|
||
npm ci
|
||
npm run build
|
||
working-directory: web-ui
|
||
|
||
# 安装后端(含 [web,packaging] extras:fastapi/uvicorn + pystray/Pillow)
|
||
- name: Install Python deps
|
||
run: |
|
||
pip install -e ".[web,packaging]"
|
||
pip install pyinstaller
|
||
|
||
- name: Build EXE
|
||
run: pyinstaller easy_tdx.spec --noconfirm
|
||
|
||
# 重命名为带版本号的文件名,方便老人下载时识别
|
||
- name: Rename EXE with version
|
||
shell: bash
|
||
run: |
|
||
VERSION="${GITHUB_REF_NAME#v}"
|
||
mv dist/easy-tdx.exe "dist/easy-tdx-${VERSION}-windows.exe"
|
||
ls -lh dist/
|
||
|
||
- uses: actions/upload-artifact@v4
|
||
with:
|
||
name: easy-tdx-windows-exe
|
||
path: dist/easy-tdx-*-windows.exe
|
||
if-no-files-found: error
|
||
|
||
release:
|
||
name: Publish GitHub Release
|
||
needs: build-windows
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- uses: actions/download-artifact@v4
|
||
with:
|
||
name: easy-tdx-windows-exe
|
||
path: dist
|
||
|
||
- name: Create release
|
||
uses: softprops/action-gh-release@v2
|
||
with:
|
||
files: dist/easy-tdx-*-windows.exe
|
||
generate_release_notes: true
|
||
body: |
|
||
## 下载使用
|
||
|
||
1. 下载下方 `easy-tdx-*-windows.exe`(约 80-150MB)
|
||
2. 双击运行
|
||
3. 浏览器会自动打开回测界面(地址 `http://localhost:8000`)
|
||
|
||
## ⚠️ SmartScreen 提示
|
||
|
||
本版本未做代码签名,首次运行 Windows 会弹出"已保护你的电脑":
|
||
|
||
1. 点击 **更多信息**
|
||
2. 点击 **仍要运行**
|
||
|
||
Phase 2 将引入代码签名消除此提示。
|