Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

release_version: Do not use prerelease field (#43669)

Piotr Osiewicz02fbafcda603
diff --git a/Cargo.lock b/Cargo.lock
index f10c2e1d132..8d4baa2e522 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 0e31f94f5ee..2b1421e35dc 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 aeaa6ae93e6..6c32ee3b6c9 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::<UpdateNotification>(),
diff --git a/crates/release_channel/src/lib.rs b/crates/release_channel/src/lib.rs
index e84bf91c1db..65201ccc46c 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