fix: Windows JSON patch via node, Linux AppImage via APPIMAGE_EXTRACT_AND_RUN
Windows: ConvertTo-Json outputs True/False (invalid JSON) and UTF-16 BOM, corrupting tauri.conf.json. Switch to `node -e` which round-trips JSON correctly. Linux: linuxdeploy is itself an AppImage and cannot execute inside Docker without FUSE. APPIMAGE_EXTRACT_AND_RUN=1 makes it self-extract and run as a plain binary instead. Also fix unreachable_code warning in check_for_update. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,9 +61,7 @@ jobs:
|
||||
shell: powershell
|
||||
run: |
|
||||
$ver = '${{ needs.prepare.outputs.version }}'
|
||||
$d = Get-Content 'src-tauri/tauri.conf.json' -Raw | ConvertFrom-Json
|
||||
$d.version = $ver
|
||||
$d | ConvertTo-Json -Depth 100 | Set-Content 'src-tauri/tauri.conf.json' -Encoding UTF8
|
||||
node -e "const fs=require('fs');const d=JSON.parse(fs.readFileSync('src-tauri/tauri.conf.json','utf8'));d.version='$ver';fs.writeFileSync('src-tauri/tauri.conf.json',JSON.stringify(d,null,2),'utf8');"
|
||||
|
||||
- name: Install frontend deps
|
||||
shell: powershell
|
||||
@@ -164,6 +162,7 @@ jobs:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
|
||||
NODE_OPTIONS: '--max_old_space_size=4096'
|
||||
APPIMAGE_EXTRACT_AND_RUN: '1'
|
||||
run: npm run tauri -- build --bundles appimage,deb
|
||||
|
||||
- name: Upload to release
|
||||
|
||||
@@ -61,14 +61,13 @@ async fn check_for_update(app: tauri::AppHandle) -> Result<UpdateInfo, String> {
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
{
|
||||
use tauri_plugin_updater::UpdaterExt;
|
||||
match app.updater().map_err(|e| e.to_string())?.check().await {
|
||||
Ok(Some(update)) => {
|
||||
return Ok(UpdateInfo { available: true, version: Some(update.version) });
|
||||
}
|
||||
Ok(None) => return Ok(UpdateInfo { available: false, version: None }),
|
||||
Err(e) => return Err(e.to_string()),
|
||||
}
|
||||
return match app.updater().map_err(|e| e.to_string())?.check().await {
|
||||
Ok(Some(update)) => Ok(UpdateInfo { available: true, version: Some(update.version) }),
|
||||
Ok(None) => Ok(UpdateInfo { available: false, version: None }),
|
||||
Err(e) => Err(e.to_string()),
|
||||
};
|
||||
}
|
||||
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||
Ok(UpdateInfo { available: false, version: None })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user