更新版本号到v0.6.2 #28
Workflow file for this run
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) | |
| # 触发条件: | |
| # 1. 推送 v 开头的 tag 时触发(用于发布新版本) | |
| # 2. 手动触发(workflow_dispatch) | |
| on: | |
| push: | |
| tags: [ 'v*' ] | |
| workflow_dispatch: | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| # 1. 检出代码到 GitHub Windows 服务器 | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # 2. 安装 Rust | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| target: x86_64-pc-windows-msvc | |
| # 3. 添加 wasm32-unknown-unknown 目标 | |
| - name: Add wasm32-unknown-unknown target | |
| run: rustup target add wasm32-unknown-unknown | |
| # 4. 安装 cargo-tauri CLI 工具 | |
| - name: Install tauri-cli | |
| run: cargo install tauri-cli --locked | |
| # 5. 安装 wasm-pack | |
| - name: Install wasm-pack | |
| run: cargo install wasm-pack | |
| # 6. 缓存 Rust 依赖 | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: | | |
| './src-tauri -> target' | |
| './wasm-viewstage -> wasm-viewstage/target' | |
| # 7. 编译 WASM 模块 | |
| - name: Build WASM module | |
| run: wasm-pack build --target web | |
| working-directory: ./wasm-viewstage | |
| # 8. 复制 WASM 文件到 src/wasm 目录 | |
| - name: Copy WASM files to src/wasm directory | |
| run: | | |
| New-Item -ItemType Directory -Path "src/wasm" -Force | |
| Copy-Item -Path "wasm-viewstage/pkg/wasm_viewstage.js" -Destination "src/wasm/" -Force | |
| Copy-Item -Path "wasm-viewstage/pkg/wasm_viewstage.d.ts" -Destination "src/wasm/" -Force | |
| Copy-Item -Path "wasm-viewstage/pkg/wasm_viewstage_bg.wasm" -Destination "src/wasm/" -Force | |
| Copy-Item -Path "wasm-viewstage/pkg/wasm_viewstage_bg.wasm.d.ts" -Destination "src/wasm/" -Force | |
| Write-Host "WASM files copied to src/wasm:" | |
| Get-ChildItem -Path "src/wasm" -File | |
| # 9. 编译命令 | |
| - name: Build Tauri app with cargo tauri build | |
| run: cargo tauri build | |
| working-directory: . | |
| env: | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
| TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
| # 10. 上传 Windows 编译产物 | |
| - 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/nsis/*.exe | |
| # 单独的可执行文件(本地 target/release 下的产物) | |
| src-tauri/target/release/ViewStage.exe | |
| # 11. 创建 GitHub Release 并上传构建产物 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: | | |
| src-tauri/target/release/bundle/msi/*.msi | |
| src-tauri/target/release/bundle/nsis/*.exe | |
| src-tauri/target/release/ViewStage.exe | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |