diff --git a/Cargo.lock b/Cargo.lock index f10c2e1d13210d67d16d584637c0fb7b71d61eec..8d4baa2e5221c23ff57a227a94dae4ae3859ec83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1380,6 +1380,7 @@ dependencies = [ "http_client", "markdown_preview", "release_channel", + "semver", "serde", "serde_json", "smol", diff --git a/crates/auto_update_ui/Cargo.toml b/crates/auto_update_ui/Cargo.toml index 0e31f94f5ee268cdc3274dea747bd0b05d9c80eb..2b1421e35dcbcf6fac40cd0e97a3dc839da58d9e 100644 --- a/crates/auto_update_ui/Cargo.toml +++ b/crates/auto_update_ui/Cargo.toml @@ -20,6 +20,7 @@ gpui.workspace = true http_client.workspace = true markdown_preview.workspace = true release_channel.workspace = true +semver.workspace = true serde.workspace = true serde_json.workspace = true smol.workspace = true diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rs index aeaa6ae93e635a6cab1487400fb58bd7be1bc6e1..6c32ee3b6c9b9c4974a287ff0e9a988472cecf3b 100644 --- a/crates/auto_update_ui/src/auto_update_ui.rs +++ b/crates/auto_update_ui/src/auto_update_ui.rs @@ -148,7 +148,9 @@ pub fn notify_if_app_was_updated(cx: &mut App) { let should_show_notification = should_show_notification.await?; if should_show_notification { cx.update(|cx| { - let version = updater.read(cx).current_version(); + let mut version = updater.read(cx).current_version(); + version.build = semver::BuildMetadata::EMPTY; + version.pre = semver::Prerelease::EMPTY; let app_name = ReleaseChannel::global(cx).display_name(); show_app_notification( NotificationId::unique::(), diff --git a/crates/release_channel/src/lib.rs b/crates/release_channel/src/lib.rs index e84bf91c1db5e891abae0aeb67089cc40b1ec009..65201ccc46caccdf4912b69fa296d468dfdea95d 100644 --- a/crates/release_channel/src/lib.rs +++ b/crates/release_channel/src/lib.rs @@ -90,11 +90,19 @@ impl AppVersion { } else { pkg_version.parse().expect("invalid version in Cargo.toml") }; + let mut pre = String::from(RELEASE_CHANNEL.dev_name()); + if let Some(build_id) = build_id { - version.pre = semver::Prerelease::new(&build_id).expect("Invalid build identifier"); + pre.push('.'); + pre.push_str(&build_id); } + if let Some(sha) = commit_sha { - version.build = semver::BuildMetadata::new(&sha.0).expect("Invalid build metadata"); + pre.push('.'); + pre.push_str(&sha.0); + } + if let Ok(build) = semver::BuildMetadata::new(&pre) { + version.build = build; } version