Decouple sidecar versioning from app versioning
Some checks failed
Build Sidecars / Bump sidecar version and tag (push) Successful in 3s
Release / Bump version and tag (push) Failing after 3s
Release / Build App (Linux) (push) Has been skipped
Release / Build App (Windows) (push) Has been skipped
Release / Build App (macOS) (push) Has been skipped
Build Sidecars / Build Sidecar (macOS) (push) Successful in 5m28s
Build Sidecars / Build Sidecar (Linux) (push) Successful in 13m54s
Build Sidecars / Build Sidecar (Windows) (push) Successful in 37m38s
Some checks failed
Build Sidecars / Bump sidecar version and tag (push) Successful in 3s
Release / Bump version and tag (push) Failing after 3s
Release / Build App (Linux) (push) Has been skipped
Release / Build App (Windows) (push) Has been skipped
Release / Build App (macOS) (push) Has been skipped
Build Sidecars / Build Sidecar (macOS) (push) Successful in 5m28s
Build Sidecars / Build Sidecar (Linux) (push) Successful in 13m54s
Build Sidecars / Build Sidecar (Windows) (push) Successful in 37m38s
Sidecar now has its own version (1.0.0) and release lifecycle: - Sidecar tags: sidecar-v1.0.0, sidecar-v1.0.1, etc. - App tags: v0.2.x (unchanged) - Sidecar workflow triggers only on python/** changes or manual dispatch - App release no longer bumps python/pyproject.toml Sidecar version tracked via sidecar-version.txt in app data dir: - resolve_sidecar_path() reads version from file instead of CARGO_PKG_VERSION - download_sidecar() fetches latest sidecar-v* release from Gitea API - check_sidecar_update() compares local vs remote sidecar versions - Version file written after successful download Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,10 +56,33 @@ impl SidecarManager {
|
||||
cfg!(debug_assertions) || std::env::var("VOICE_TO_NOTES_DEV").is_ok()
|
||||
}
|
||||
|
||||
/// Read the locally installed sidecar version from `sidecar-version.txt`.
|
||||
fn read_sidecar_version() -> Result<String, String> {
|
||||
let data_dir = DATA_DIR.get().ok_or("App data directory not initialized")?;
|
||||
let version_file = data_dir.join("sidecar-version.txt");
|
||||
std::fs::read_to_string(&version_file)
|
||||
.map_err(|_| {
|
||||
"Sidecar not installed: sidecar-version.txt not found. Please download the sidecar."
|
||||
.to_string()
|
||||
})
|
||||
.map(|v| v.trim().to_string())
|
||||
.and_then(|v| {
|
||||
if v.is_empty() {
|
||||
Err(
|
||||
"Sidecar version file is empty. Please re-download the sidecar."
|
||||
.to_string(),
|
||||
)
|
||||
} else {
|
||||
Ok(v)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Resolve the frozen sidecar binary path (production mode).
|
||||
///
|
||||
/// First checks if the sidecar is already extracted to the app data directory.
|
||||
/// If not, looks for `sidecar.zip` in the Tauri resource directory and extracts it.
|
||||
/// Reads the installed sidecar version from `sidecar-version.txt` and
|
||||
/// looks for the binary in the corresponding `sidecar-{version}` directory.
|
||||
/// If the version file doesn't exist, the sidecar hasn't been downloaded yet.
|
||||
fn resolve_sidecar_path() -> Result<PathBuf, String> {
|
||||
let binary_name = if cfg!(target_os = "windows") {
|
||||
"voice-to-notes-sidecar.exe"
|
||||
@@ -67,16 +90,15 @@ impl SidecarManager {
|
||||
"voice-to-notes-sidecar"
|
||||
};
|
||||
|
||||
// Versioned extraction directory prevents stale sidecar after app updates
|
||||
let data_dir = DATA_DIR.get().ok_or("App data directory not initialized")?;
|
||||
let current_version = env!("CARGO_PKG_VERSION");
|
||||
let current_version = Self::read_sidecar_version()?;
|
||||
let extract_dir = data_dir.join(format!("sidecar-{}", current_version));
|
||||
|
||||
let binary_path = extract_dir.join(binary_name);
|
||||
|
||||
// Already extracted — use it directly
|
||||
if binary_path.exists() {
|
||||
Self::cleanup_old_sidecars(data_dir, current_version);
|
||||
Self::cleanup_old_sidecars(data_dir, ¤t_version);
|
||||
return Ok(binary_path);
|
||||
}
|
||||
|
||||
@@ -102,7 +124,7 @@ impl SidecarManager {
|
||||
}
|
||||
}
|
||||
|
||||
Self::cleanup_old_sidecars(data_dir, current_version);
|
||||
Self::cleanup_old_sidecars(data_dir, ¤t_version);
|
||||
Ok(binary_path)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user