releases: Add build number to Nightly builds (#42990)
- **Remove semantic_version crate and use semver instead** - **Update upload-nightly** Release Notes: - N/A --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
co-authored by
Conrad Irwin
parent
a0fa5d57c1
commit
2d55c088cc
@@ -11,7 +11,7 @@ use prompt_store::ProjectContext;
|
||||
|
||||
use extension::ExtensionHostProxy;
|
||||
use fs::{FakeFs, Fs};
|
||||
use gpui::{AppContext as _, Entity, SemanticVersion, SharedString, TestAppContext};
|
||||
use gpui::{AppContext as _, Entity, SharedString, TestAppContext};
|
||||
use http_client::{BlockedHttpClient, FakeHttpClient};
|
||||
use language::{
|
||||
Buffer, FakeLspAdapter, LanguageConfig, LanguageMatcher, LanguageRegistry, LineEnding,
|
||||
@@ -1503,7 +1503,7 @@ async fn test_remote_git_diffs_when_recv_update_repository_delay(
|
||||
let settings_store = SettingsStore::test(cx);
|
||||
cx.set_global(settings_store);
|
||||
theme::init(theme::LoadThemes::JustBase, cx);
|
||||
release_channel::init(SemanticVersion::default(), cx);
|
||||
release_channel::init(semver::Version::new(0, 0, 0), cx);
|
||||
editor::init(cx);
|
||||
});
|
||||
|
||||
@@ -1910,10 +1910,10 @@ pub async fn init_test(
|
||||
) -> (Entity<Project>, Entity<HeadlessProject>) {
|
||||
let server_fs = server_fs.clone();
|
||||
cx.update(|cx| {
|
||||
release_channel::init(SemanticVersion::default(), cx);
|
||||
release_channel::init(semver::Version::new(0, 0, 0), cx);
|
||||
});
|
||||
server_cx.update(|cx| {
|
||||
release_channel::init(SemanticVersion::default(), cx);
|
||||
release_channel::init(semver::Version::new(0, 0, 0), cx);
|
||||
});
|
||||
init_logger();
|
||||
|
||||
|
||||
@@ -71,10 +71,14 @@ pub fn run(command: Commands) -> anyhow::Result<()> {
|
||||
println!("{}", env!("ZED_PKG_VERSION"))
|
||||
}
|
||||
ReleaseChannel::Nightly | ReleaseChannel::Dev => {
|
||||
println!(
|
||||
"{}",
|
||||
option_env!("ZED_COMMIT_SHA").unwrap_or(release_channel.dev_name())
|
||||
)
|
||||
let commit_sha =
|
||||
option_env!("ZED_COMMIT_SHA").unwrap_or(release_channel.dev_name());
|
||||
let build_id = option_env!("ZED_BUILD_ID");
|
||||
if let Some(build_id) = build_id {
|
||||
println!("{}+{}", build_id, commit_sha)
|
||||
} else {
|
||||
println!("{commit_sha}");
|
||||
}
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
|
||||
@@ -9,7 +9,7 @@ use fs::{Fs, RealFs};
|
||||
use futures::channel::{mpsc, oneshot};
|
||||
use futures::{AsyncRead, AsyncWrite, AsyncWriteExt, FutureExt, SinkExt, select, select_biased};
|
||||
use git::GitHostingProviderRegistry;
|
||||
use gpui::{App, AppContext as _, Context, Entity, SemanticVersion, UpdateGlobal as _};
|
||||
use gpui::{App, AppContext as _, Context, Entity, UpdateGlobal as _};
|
||||
use gpui_tokio::Tokio;
|
||||
use http_client::{Url, read_proxy_from_env};
|
||||
use language::LanguageRegistry;
|
||||
@@ -19,7 +19,7 @@ use project::project_settings::ProjectSettings;
|
||||
use util::command::new_smol_command;
|
||||
|
||||
use proto::CrashReport;
|
||||
use release_channel::{AppVersion, RELEASE_CHANNEL, ReleaseChannel};
|
||||
use release_channel::{AppCommitSha, AppVersion, RELEASE_CHANNEL, ReleaseChannel};
|
||||
use remote::RemoteClient;
|
||||
use remote::{
|
||||
json_log::LogRecord,
|
||||
@@ -48,10 +48,16 @@ use std::{
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
pub static VERSION: LazyLock<&str> = LazyLock::new(|| match *RELEASE_CHANNEL {
|
||||
ReleaseChannel::Stable | ReleaseChannel::Preview => env!("ZED_PKG_VERSION"),
|
||||
pub static VERSION: LazyLock<String> = LazyLock::new(|| match *RELEASE_CHANNEL {
|
||||
ReleaseChannel::Stable | ReleaseChannel::Preview => env!("ZED_PKG_VERSION").to_owned(),
|
||||
ReleaseChannel::Nightly | ReleaseChannel::Dev => {
|
||||
option_env!("ZED_COMMIT_SHA").unwrap_or("missing-zed-commit-sha")
|
||||
let commit_sha = option_env!("ZED_COMMIT_SHA").unwrap_or("missing-zed-commit-sha");
|
||||
let build_identifier = option_env!("ZED_BUILD_ID");
|
||||
if let Some(build_id) = build_identifier {
|
||||
format!("{build_id}+{commit_sha}")
|
||||
} else {
|
||||
commit_sha.to_owned()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -390,7 +396,12 @@ pub fn execute_run(
|
||||
let git_hosting_provider_registry = Arc::new(GitHostingProviderRegistry::new());
|
||||
app.run(move |cx| {
|
||||
settings::init(cx);
|
||||
let app_version = AppVersion::load(env!("ZED_PKG_VERSION"));
|
||||
let app_commit_sha = option_env!("ZED_COMMIT_SHA").map(|s| AppCommitSha::new(s.to_owned()));
|
||||
let app_version = AppVersion::load(
|
||||
env!("ZED_PKG_VERSION"),
|
||||
option_env!("ZED_BUILD_ID"),
|
||||
app_commit_sha,
|
||||
);
|
||||
release_channel::init(app_version, cx);
|
||||
gpui_tokio::init(cx);
|
||||
|
||||
@@ -1002,9 +1013,9 @@ fn cleanup_old_binaries() -> Result<()> {
|
||||
}
|
||||
|
||||
fn is_new_version(version: &str) -> bool {
|
||||
SemanticVersion::from_str(version)
|
||||
semver::Version::from_str(version)
|
||||
.ok()
|
||||
.zip(SemanticVersion::from_str(env!("ZED_PKG_VERSION")).ok())
|
||||
.zip(semver::Version::from_str(env!("ZED_PKG_VERSION")).ok())
|
||||
.is_some_and(|(version, current_version)| version >= current_version)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user