版本号切换到0.2.2 #18
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) | |
| # 触发条件:检测到版本更新、手动触发 | |
| on: | |
| push: | |
| tags: [ 'v*' ] # 仅匹配v开头的Tag | |
| 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 # 本地Windows默认编译目标 | |
| # 3. 添加wasm32-unknown-unknown目标 | |
| - name: Add wasm32-unknown-unknown target | |
| run: rustup target add wasm32-unknown-unknown | |
| # 3. 安装cargo-tauri CLI工具 | |
| - name: Install tauri-cli | |
| run: cargo install tauri-cli --locked | |
| # 4. 安装wasm-pack | |
| - name: Install wasm-pack | |
| run: cargo install wasm-pack | |
| # 5. 缓存Rust依赖 | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: | | |
| './src-tauri -> target' | |
| './wasm-viewstage -> wasm-viewstage/target' | |
| # 6. 编译WASM模块 | |
| - name: Build WASM module | |
| run: wasm-pack build --target web | |
| working-directory: ./wasm-viewstage | |
| # 7. 复制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 | |
| # 8. 编译命令 | |
| - name: Build Tauri app with cargo tauri build | |
| run: cargo tauri build | |
| working-directory: . # 确保在项目根目录执行 | |
| # 9. 上传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/exe/*.exe | |
| # 单独的可执行文件(本地target/release下的产物) | |
| src-tauri/target/release/ViewStage.exe | |
| # 10. 创建 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/exe/*.exe | |
| src-tauri/target/release/ViewStage.exe | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |