Add nightly release channel for zed2 (#3355)

Release Notes:

- N/A
This commit is contained in:
Mikayla Maki 2023-11-17 22:12:18 -08:00 committed by GitHub
commit e1285b9780
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 914 additions and 97 deletions

View file

@ -1,6 +1,5 @@
use std::env;
use lazy_static::lazy_static;
use std::env;
lazy_static! {
pub static ref RELEASE_CHANNEL_NAME: String = if cfg!(debug_assertions) {
@ -9,18 +8,22 @@ lazy_static! {
} else {
include_str!("../../zed/RELEASE_CHANNEL").to_string()
};
pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str() {
pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str().trim() {
"dev" => ReleaseChannel::Dev,
"nightly" => ReleaseChannel::Nightly,
"preview" => ReleaseChannel::Preview,
"stable" => ReleaseChannel::Stable,
_ => panic!("invalid release channel {}", *RELEASE_CHANNEL_NAME),
};
}
pub struct AppCommitSha(pub String);
#[derive(Copy, Clone, PartialEq, Eq, Default)]
pub enum ReleaseChannel {
#[default]
Dev,
Nightly,
Preview,
Stable,
}
@ -29,6 +32,7 @@ impl ReleaseChannel {
pub fn display_name(&self) -> &'static str {
match self {
ReleaseChannel::Dev => "Zed Dev",
ReleaseChannel::Nightly => "Zed Nightly",
ReleaseChannel::Preview => "Zed Preview",
ReleaseChannel::Stable => "Zed",
}
@ -37,6 +41,7 @@ impl ReleaseChannel {
pub fn dev_name(&self) -> &'static str {
match self {
ReleaseChannel::Dev => "dev",
ReleaseChannel::Nightly => "nightly",
ReleaseChannel::Preview => "preview",
ReleaseChannel::Stable => "stable",
}
@ -45,6 +50,7 @@ impl ReleaseChannel {
pub fn url_scheme(&self) -> &'static str {
match self {
ReleaseChannel::Dev => "zed-dev://",
ReleaseChannel::Nightly => "zed-nightly://",
ReleaseChannel::Preview => "zed-preview://",
ReleaseChannel::Stable => "zed://",
}
@ -53,15 +59,27 @@ impl ReleaseChannel {
pub fn link_prefix(&self) -> &'static str {
match self {
ReleaseChannel::Dev => "https://zed.dev/dev/",
// TODO kb need to add server handling
ReleaseChannel::Nightly => "https://zed.dev/nightly/",
ReleaseChannel::Preview => "https://zed.dev/preview/",
ReleaseChannel::Stable => "https://zed.dev/",
}
}
pub fn release_query_param(&self) -> Option<&'static str> {
match self {
Self::Dev => None,
Self::Nightly => Some("nightly=1"),
Self::Preview => Some("preview=1"),
Self::Stable => None,
}
}
}
pub fn parse_zed_link(link: &str) -> Option<&str> {
for release in [
ReleaseChannel::Dev,
ReleaseChannel::Nightly,
ReleaseChannel::Preview,
ReleaseChannel::Stable,
] {