功能: - Tauri v2 GUI 应用 - 系统托盘支持 - 日志输出到文件 - 带时间戳的版本号 - 前端资源嵌入 修复: - 前端路径使用相对路径 - 移除 devUrl 配置 - 窗口置顶设置
120 lines
3.1 KiB
YAML
120 lines
3.1 KiB
YAML
name: Build Windows GUI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'src/**'
|
|
- 'web/**'
|
|
- 'Cargo.toml'
|
|
- 'tauri.conf.json'
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUSTFLAGS: "-C target-feature=+crt-static"
|
|
|
|
jobs:
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
timeout-minutes: 60
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-action@stable
|
|
with:
|
|
targets: x86_64-pc-windows-msvc
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: web/package-lock.json
|
|
|
|
- name: Install frontend dependencies
|
|
run: |
|
|
cd web
|
|
npm ci
|
|
|
|
- name: Build frontend
|
|
run: |
|
|
cd web
|
|
npm run build
|
|
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Build Windows GUI
|
|
run: cargo build --release --features gui --verbose
|
|
|
|
- name: Build CLI tool
|
|
run: cargo build --release --verbose
|
|
|
|
- name: Verify build artifacts
|
|
run: |
|
|
echo "=== Build Artifacts ==="
|
|
dir target\release\*.exe
|
|
echo "=== GUI Size ==="
|
|
(Get-Item target\release\impress_asr_gui.exe).Length / 1MB
|
|
echo "=== CLI Size ==="
|
|
(Get-Item target\release\impress_asr.exe).Length / 1MB
|
|
|
|
- name: Create distribution package
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path dist
|
|
Copy-Item target\release\impress_asr_gui.exe dist/
|
|
Copy-Item target\release\impress_asr.exe dist/
|
|
Copy-Item README.md dist/
|
|
Copy-Item LICENSE dist/
|
|
New-Item -ItemType Directory -Force -Path dist/models
|
|
echo "Please download ONNX models to this directory" > dist/models/README.txt
|
|
echo "Model download links:" >> dist/models/README.txt
|
|
echo "- SenseVoice Small: https://huggingface.co/FunAudioLLM/SenseVoiceSmall/resolve/main/model.onnx" >> dist/models/README.txt
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: impress-asr-input-rust-windows-x64
|
|
path: dist/
|
|
retention-days: 30
|
|
|
|
# Optional: Create release if tagged
|
|
release:
|
|
needs: build-windows
|
|
runs-on: windows-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: impress-asr-input-rust-windows-x64
|
|
path: ./dist
|
|
|
|
- name: Create ZIP archive
|
|
run: |
|
|
$zipName = "impress-asr-input-rust-${{ github.ref_name }}-windows-x64.zip"
|
|
Compress-Archive -Path dist\* -DestinationPath $zipName
|
|
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: ${{ env.ZIP_FILE }}
|
|
generate_release_notes: true
|
|
draft: true
|