Tauri Build #7
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
| # .github/workflows/tauri-build.yml | |
| name: Tauri Build (Windows) | |
| # 触发条件:检测到版本更新、手动触发 | |
| on: | |
| push: | |
| tags: [ 'v*' ] # 仅匹配v开头的Tag(如v0.1.0、v1.2.3) | |
| workflow_dispatch: # 保留手动触发,方便临时编译 | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| # 1. 拉取代码到GitHub Windows服务器 | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # 2. 安装Rust(和本地稳定版一致,Tauri编译核心依赖) | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| target: x86_64-pc-windows-msvc # 本地Windows默认编译目标 | |
| # 3. 安装cargo-tauri CLI工具(核心修复步骤!) | |
| - name: Install tauri-cli | |
| run: cargo install tauri-cli --locked | |
| # 4. 缓存Rust依赖(加速cargo build,和本地cargo缓存逻辑一致) | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: './src-tauri -> target' | |
| # 5. 执行和本地完全一致的编译命令(核心步骤) | |
| - name: Build Tauri app with cargo tauri build | |
| run: cargo tauri build | |
| working-directory: . # 确保在项目根目录执行,和本地一致 | |
| # 6. 上传Windows编译产物(和本地target目录输出一致) | |
| - name: Upload Windows build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: viewstage-windows | |
| path: | | |
| # 产物路径和本地src-tauri/target/release/bundle完全一致 | |
| src-tauri/target/release/bundle/msi/*.msi | |
| src-tauri/target/release/bundle/exe/*.exe | |
| # 单独的可执行文件(本地target/release下的产物) | |
| src-tauri/target/release/ViewStage.exe |