Skip to content

Commit 3a561b3

Browse files
author
AENERV7
committed
feat: bundle WebView2 Fixed Version Runtime in portable zip
- Set WEBVIEW2_BROWSER_EXECUTABLE_FOLDER env var in main.rs before Tauri init, pointing to a 'runtime' folder next to the exe. This lets the app use the bundled WebView2 runtime on machines without Edge or the Evergreen WebView2 Runtime installed. - Set webviewInstallMode to skip (no installer needed) - CI downloads WebView2 Fixed Version cab (133.0.3065.92) from westinyang/WebView2RuntimeArchive, extracts it, and packages it alongside yauz.exe in the release zip - Windows release artifact is now YAUZ-windows-x64.zip containing yauz.exe + runtime/ folder (~250MB total) - Bump version to 0.5.4
1 parent 108d7ce commit 3a561b3

5 files changed

Lines changed: 47 additions & 16 deletions

File tree

.github/workflows/build.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ on:
88
permissions:
99
contents: write
1010

11+
# WebView2 Fixed Version Runtime — bundled into the Windows zip for
12+
# machines without Edge / WebView2 Runtime installed.
13+
# Archive source: https://github.com/westinyang/WebView2RuntimeArchive
14+
# To update: pick a newer release tag and change the version below.
15+
env:
16+
WEBVIEW2_VERSION: "133.0.3065.92"
17+
1118
jobs:
1219
build:
1320
strategy:
@@ -39,20 +46,37 @@ jobs:
3946

4047
- name: Build Tauri app (Windows)
4148
if: matrix.os == 'windows-latest'
42-
run: npx tauri build --target ${{ matrix.target }} --bundles nsis
49+
run: npx tauri build --target ${{ matrix.target }}
4350

4451
- name: Build Tauri app (macOS)
4552
if: matrix.os == 'macos-latest'
4653
run: npx tauri build --target ${{ matrix.target }} --bundles app
4754

55+
- name: Download WebView2 Fixed Version Runtime
56+
if: matrix.os == 'windows-latest'
57+
shell: pwsh
58+
run: |
59+
$cabUrl = "https://github.com/westinyang/WebView2RuntimeArchive/releases/download/${{ env.WEBVIEW2_VERSION }}/Microsoft.WebView2.FixedVersionRuntime.${{ env.WEBVIEW2_VERSION }}.x64.cab"
60+
Invoke-WebRequest -Uri $cabUrl -OutFile webview2.cab
61+
mkdir runtime-extract
62+
expand webview2.cab -F:* runtime-extract
63+
# The cab extracts to a versioned subfolder — rename to "runtime"
64+
$subdir = Get-ChildItem runtime-extract -Directory | Select-Object -First 1
65+
if ($subdir) {
66+
Move-Item $subdir.FullName "runtime"
67+
} else {
68+
Rename-Item "runtime-extract" "runtime"
69+
}
70+
4871
- name: Prepare Windows artifact
4972
if: matrix.os == 'windows-latest'
50-
shell: bash
73+
shell: pwsh
5174
run: |
52-
cp "src-tauri/target/${{ matrix.target }}/release/yauz.exe" "YAUZ-windows-x64.exe"
53-
NSIS_DIR="src-tauri/target/${{ matrix.target }}/release/bundle/nsis"
54-
SETUP_FILE=$(ls "$NSIS_DIR"/*-setup.exe 2>/dev/null | head -1)
55-
cp "$SETUP_FILE" "YAUZ-windows-x64-setup.exe"
75+
$stageDir = "YAUZ-windows-x64"
76+
mkdir $stageDir
77+
Copy-Item "src-tauri/target/${{ matrix.target }}/release/yauz.exe" "$stageDir/yauz.exe"
78+
Copy-Item -Recurse "runtime" "$stageDir/runtime"
79+
Compress-Archive -Path "$stageDir/*" -DestinationPath "YAUZ-windows-x64.zip"
5680
5781
- name: Prepare macOS artifact
5882
if: matrix.os == 'macos-latest'
@@ -64,6 +88,5 @@ jobs:
6488
uses: softprops/action-gh-release@v2.6.1
6589
with:
6690
files: |
67-
YAUZ-windows-x64.exe
68-
YAUZ-windows-x64-setup.exe
91+
YAUZ-windows-x64.zip
6992
YAUZ-macos-arm64.zip

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "yauz",
3-
"version": "0.5.3",
3+
"version": "0.5.4",
44
"private": true,
55
"scripts": {
66
"tauri": "tauri",

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "yauz"
3-
version = "0.5.3"
3+
version = "0.5.4"
44
edition = "2021"
55

66
[lib]

src-tauri/src/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,17 @@
22
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
33

44
fn main() {
5+
// On Windows, point WebView2 to the bundled Fixed Version runtime
6+
// located in a "runtime" folder next to the executable, so the app
7+
// works on machines without Edge or the Evergreen WebView2 Runtime.
8+
#[cfg(target_os = "windows")]
9+
{
10+
let exe = std::env::current_exe().expect("failed to get exe path");
11+
let runtime_dir = exe.parent().unwrap().join("runtime");
12+
if runtime_dir.exists() {
13+
std::env::set_var("WEBVIEW2_BROWSER_EXECUTABLE_FOLDER", &runtime_dir);
14+
}
15+
}
16+
517
app_lib::run();
618
}

src-tauri/tauri.conf.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"productName": "YAUZ",
3-
"version": "0.5.3",
3+
"version": "0.5.4",
44
"identifier": "com.yauz.dev",
55
"build": {
66
"frontendDist": "../dist"
@@ -24,11 +24,7 @@
2424
"icon": ["icons/icon.png", "icons/icon.ico", "icons/icon.icns"],
2525
"windows": {
2626
"webviewInstallMode": {
27-
"type": "offlineInstaller",
28-
"silent": true
29-
},
30-
"nsis": {
31-
"installMode": "both"
27+
"type": "skip"
3228
}
3329
},
3430
"macOS": {

0 commit comments

Comments
 (0)