mirror of
https://ghfast.top/https://github.com/aeroxw/tick-stock-panel.git
synced 2026-09-12 19:04:15 +08:00
- release.yml body 模板: 下载表格每行加「⬇️ 立即下载」按钮
· 用 $github.repository + 版本号变量拼稳定下载 URL
· CI 自动填充, 无需手动改链接
- v0.1.35 Release 已同步更新 (本地 gh release edit)
- 新增 generate_icon_designs.py (图标设计方案生成, 选定方案后产出最终 ico)
169 lines
6.7 KiB
YAML
169 lines
6.7 KiB
YAML
name: 桌面客户端发布
|
|
|
|
# 触发方式: 手动 (workflow_dispatch)。
|
|
# 在 GitHub Actions 页面点 "Run workflow", 选择要构建的平台 + 版本号,
|
|
# 构建完成后自动创建/更新 Release 并上传安装包。
|
|
#
|
|
# 为什么不用 tag 自动触发:
|
|
# - 多平台并行构建, mac/linux 未就绪时会自动失败污染 Release
|
|
# - 手动触发可精确控制 "今天只发 Windows, 明天补 mac"
|
|
# - 版本号通过 input 传入, 与 tag 解耦, 更灵活
|
|
#
|
|
# 使用:
|
|
# gh workflow run release.yml -f version=v0.2.0 -f platforms=windows
|
|
# 或 GitHub 网页 Actions → 桌面客户端发布 → Run workflow
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: '版本号 (如 v0.1.33, 用作 Release tag 和标题)'
|
|
required: true
|
|
default: 'v0.1.33'
|
|
platforms:
|
|
description: '要构建的平台 (逗号分隔: windows,macos,linux)'
|
|
required: true
|
|
default: 'windows'
|
|
prerelease:
|
|
description: '是否为预发布 (勾选则标记为 Pre-release)'
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: write # 创建 Release 需要写权限
|
|
|
|
jobs:
|
|
# 第一步: 过滤出本次要构建的平台
|
|
prepare:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.filter.outputs.matrix }}
|
|
steps:
|
|
- id: filter
|
|
run: |
|
|
REQUESTED="${{ github.event.inputs.platforms }}"
|
|
ALL='[{"os":"windows-latest","artifact":"TickFlowStockPanel-Setup-x64.exe","platform":"windows"},{"os":"macos-latest","artifact":"TickFlowStockPanel-macos.zip","platform":"macos"},{"os":"ubuntu-latest","artifact":"TickFlowStockPanel-linux-x64.tar.gz","platform":"linux"}]'
|
|
# 按 input 过滤平台
|
|
python3 -c "
|
|
import json, sys
|
|
requested = '${{ github.event.inputs.platforms }}'.split(',')
|
|
requested = [r.strip() for r in requested if r.strip()]
|
|
all_platforms = json.loads('''$ALL''')
|
|
selected = [p for p in all_platforms if p['platform'] in requested]
|
|
print('matrix=' + json.dumps({'include': selected}))
|
|
with open('$GITHUB_OUTPUT', 'a') as f:
|
|
f.write('matrix=' + json.dumps({'include': selected}) + '\n')
|
|
"
|
|
|
|
# 第二步: 各平台并行构建
|
|
build:
|
|
needs: prepare
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false # 单平台失败不影响其他平台
|
|
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
|
steps:
|
|
- name: 检出代码
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 安装 pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- name: 设置 Node 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'pnpm'
|
|
cache-dependency-path: frontend/pnpm-lock.yaml
|
|
|
|
- name: 构建前端
|
|
working-directory: frontend
|
|
run: |
|
|
pnpm install --frozen-lockfile
|
|
pnpm build
|
|
|
|
- name: 安装 uv
|
|
uses: astral-sh/setup-uv@v3
|
|
with:
|
|
enable-cache: true
|
|
|
|
- name: 设置 Python
|
|
run: uv python install 3.12
|
|
|
|
- name: 安装后端依赖 (含 desktop, 不含 backtest)
|
|
working-directory: backend
|
|
# --no-dev 排除 pytest/ruff/mypy; --extra desktop 装 pywebview
|
|
# 不加 --extra backtest, 主包不含 vectorbt/numba/llvmlite
|
|
run: uv sync --no-dev --extra desktop
|
|
|
|
- name: 安装 PyInstaller
|
|
run: uv pip install pyinstaller
|
|
|
|
- name: 打包 (PyInstaller)
|
|
run: uv run pyinstaller packaging/tickflow.spec --noconfirm
|
|
|
|
- name: 安装 Inno Setup (仅 Windows)
|
|
if: matrix.platform == 'windows'
|
|
# Inno Setup 6: 把 PyInstaller 产出封装成单文件安装包
|
|
run: choco install innosetup -y --no-progress
|
|
|
|
- name: 生成 Windows 安装包 (Inno Setup)
|
|
if: matrix.platform == 'windows'
|
|
# 从 frontend/package.json 读版本号传给 ISCC, 保持与 Release tag 一致
|
|
run: |
|
|
$ver = (Get-Content frontend/package.json | ConvertFrom-Json).version
|
|
echo "版本号: $ver"
|
|
ISCC.exe "/DMyAppVersion=$ver" packaging/tickflow.iss
|
|
# 把生成的 Setup.exe 移到工作区根 (Release 上传用)
|
|
Move-Item packaging/Output/TickFlowStockPanel-Setup-$ver.exe ${{ matrix.artifact }} -Force
|
|
shell: pwsh
|
|
|
|
- name: 压缩产物 (macOS)
|
|
if: matrix.platform == 'macos'
|
|
run: |
|
|
cd dist
|
|
zip -r -q ../${{ matrix.artifact }} TickFlowStockPanel
|
|
|
|
- name: 压缩产物 (Linux)
|
|
if: matrix.platform == 'linux'
|
|
run: |
|
|
cd dist
|
|
tar -czf ../${{ matrix.artifact }} TickFlowStockPanel
|
|
|
|
- name: 上传产物为构建产物 (备查)
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.artifact }}
|
|
path: ${{ matrix.artifact }}
|
|
|
|
- name: 上传到 GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.event.inputs.version }}
|
|
name: ${{ github.event.inputs.version }}
|
|
files: ${{ matrix.artifact }}
|
|
prerelease: ${{ github.event.inputs.prerelease }}
|
|
generate_release_notes: true # 自动从 commit 生成 changelog
|
|
body: |
|
|
## 桌面客户端 ${{ github.event.inputs.version }}
|
|
|
|
### ⬇️ 下载
|
|
|
|
| 平台 | 文件 | 下载 |
|
|
| :--- | :--- | :--- |
|
|
| **Windows x64** | `TickFlowStockPanel-Setup-x64.exe` | [⬇️ 立即下载](https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/TickFlowStockPanel-Setup-x64.exe) |
|
|
| **macOS** | `TickFlowStockPanel-macos.zip` | [⬇️ 立即下载](https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/TickFlowStockPanel-macos.zip) |
|
|
| **Linux** | `TickFlowStockPanel-linux-x64.tar.gz` | [⬇️ 立即下载](https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/TickFlowStockPanel-linux-x64.tar.gz) |
|
|
|
|
> 💡 点击「立即下载」直接获取, 无需滚动到底部附件区。
|
|
|
|
### 📋 使用说明
|
|
- **Windows**: 下载后双击运行, 按安装向导操作(无需管理员权限), 自动创建桌面/开始菜单快捷方式
|
|
- **macOS**: 解压后右键打开(首次绕过 Gatekeeper)
|
|
- **Linux**: 解压后运行可执行文件
|
|
- 数据存储在用户目录 (`%LOCALAPPDATA%`), 卸载重装不丢数据
|
|
- 含纯 Polars 回测引擎; 不含 vectorbt 回测(为控制体积)
|
|
- 系统通知: 设置 → 实时监控 → 系统通知
|
|
- 检查更新: 设置 → 系统设置 → 关于
|