feat: bundle WebView2 Fixed Version Runtime in portable zip #26
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
| name: Build & Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| # WebView2 Fixed Version Runtime — bundled into the Windows zip for | |
| # machines without Edge / WebView2 Runtime installed. | |
| # Archive source: https://github.com/westinyang/WebView2RuntimeArchive | |
| # To update: pick a newer release tag and change the version below. | |
| env: | |
| WEBVIEW2_VERSION: "133.0.3065.92" | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| - name: Install frontend dependencies | |
| run: npm install | |
| - name: Build Tauri app (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: npx tauri build --target ${{ matrix.target }} | |
| - name: Build Tauri app (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: npx tauri build --target ${{ matrix.target }} --bundles app | |
| - name: Download WebView2 Fixed Version Runtime | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| $cabUrl = "https://github.com/westinyang/WebView2RuntimeArchive/releases/download/${{ env.WEBVIEW2_VERSION }}/Microsoft.WebView2.FixedVersionRuntime.${{ env.WEBVIEW2_VERSION }}.x64.cab" | |
| Invoke-WebRequest -Uri $cabUrl -OutFile webview2.cab | |
| mkdir runtime-extract | |
| expand webview2.cab -F:* runtime-extract | |
| # The cab extracts to a versioned subfolder — rename to "runtime" | |
| $subdir = Get-ChildItem runtime-extract -Directory | Select-Object -First 1 | |
| if ($subdir) { | |
| Move-Item $subdir.FullName "runtime" | |
| } else { | |
| Rename-Item "runtime-extract" "runtime" | |
| } | |
| - name: Prepare Windows artifact | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| $stageDir = "YAUZ-windows-x64" | |
| mkdir $stageDir | |
| Copy-Item "src-tauri/target/${{ matrix.target }}/release/yauz.exe" "$stageDir/yauz.exe" | |
| Copy-Item -Recurse "runtime" "$stageDir/runtime" | |
| Compress-Archive -Path "$stageDir/*" -DestinationPath "YAUZ-windows-x64.zip" | |
| - name: Prepare macOS artifact | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| cd "src-tauri/target/${{ matrix.target }}/release/bundle/macos" | |
| zip -r "$GITHUB_WORKSPACE/YAUZ-macos-arm64.zip" YAUZ.app | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v2.6.1 | |
| with: | |
| files: | | |
| YAUZ-windows-x64.zip | |
| YAUZ-macos-arm64.zip |