1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00

fix(upgrade): don't display release information for canary (#17516)

This commit is contained in:
Leo Kettmeir 2023-01-25 16:29:27 +01:00 committed by GitHub
parent 8b7023bc7e
commit b71d224d11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -166,8 +166,19 @@ fn get_minor_version(version: &str) -> &str {
version.rsplitn(2, '.').collect::<Vec<&str>>()[1] version.rsplitn(2, '.').collect::<Vec<&str>>()[1]
} }
fn has_same_minor_version(current_version: &str, new_version: &str) -> bool { fn print_release_notes(current_version: &str, new_version: &str) {
get_minor_version(current_version) == get_minor_version(new_version) if get_minor_version(current_version) != get_minor_version(new_version) {
log::info!(
"{}{}",
"Release notes: https://github.com/denoland/deno/releases/tag/v",
&new_version,
);
log::info!(
"{}{}",
"Blog post: https://deno.com/blog/v",
get_minor_version(new_version)
);
}
} }
pub fn check_for_upgrades(http_client: HttpClient, cache_file_path: PathBuf) { pub fn check_for_upgrades(http_client: HttpClient, cache_file_path: PathBuf) {
@ -213,20 +224,7 @@ pub fn check_for_upgrades(http_client: HttpClient, cache_file_path: PathBuf) {
"{}", "{}",
colors::italic_gray("Run `deno upgrade` to install it.") colors::italic_gray("Run `deno upgrade` to install it.")
); );
eprint!( print_release_notes(&version::deno(), &upgrade_version);
"{}{}",
colors::yellow(
"Release notes: https://github.com/denoland/deno/releases/tag/v"
),
colors::yellow(&upgrade_version),
);
if !has_same_minor_version(&version::deno(), &upgrade_version) {
eprint!(
"{}{}",
colors::yellow("Blog post: https://deno.com/blog/v"),
colors::yellow(get_minor_version(&upgrade_version)),
);
}
} }
update_checker.store_prompted(); update_checker.store_prompted();
@ -312,16 +310,6 @@ pub async fn upgrade(
&& current_is_passed && current_is_passed
{ {
log::info!("Version {} is already installed", crate::version::deno()); log::info!("Version {} is already installed", crate::version::deno());
log::info!(
"{}{}",
"Release notes: https://github.com/denoland/deno/releases/tag/v",
crate::version::deno(),
);
log::info!(
"{}{}",
"Blog post: https://deno.com/blog/v",
get_minor_version(&crate::version::deno())
);
return Ok(()); return Ok(());
} else { } else {
passed_version passed_version
@ -359,18 +347,6 @@ pub async fn upgrade(
crate::version::deno() crate::version::deno()
} }
); );
if !upgrade_flags.canary {
log::info!(
"{}{}",
"Release notes: https://github.com/denoland/deno/releases/tag/v",
crate::version::deno(),
);
log::info!(
"{}{}",
"Blog post: https://deno.com/blog/v",
get_minor_version(&crate::version::deno())
);
}
return Ok(()); return Ok(());
} else { } else {
log::info!("Found latest version {}", latest_version); log::info!("Found latest version {}", latest_version);
@ -408,16 +384,9 @@ pub async fn upgrade(
if upgrade_flags.dry_run { if upgrade_flags.dry_run {
fs::remove_file(&new_exe_path)?; fs::remove_file(&new_exe_path)?;
log::info!("Upgraded successfully (dry run)"); log::info!("Upgraded successfully (dry run)");
log::info!( if !upgrade_flags.canary {
"{}{}", print_release_notes(&version::deno(), &install_version);
"Release notes: https://github.com/denoland/deno/releases/tag/v", }
install_version,
);
log::info!(
"{}{}",
"Blog post: https://deno.com/blog/v",
get_minor_version(&install_version)
);
} else { } else {
let output_exe_path = let output_exe_path =
upgrade_flags.output.as_ref().unwrap_or(&current_exe_path); upgrade_flags.output.as_ref().unwrap_or(&current_exe_path);
@ -449,16 +418,9 @@ pub async fn upgrade(
} }
} }
log::info!("Upgraded successfully"); log::info!("Upgraded successfully");
log::info!( if !upgrade_flags.canary {
"{}{}", print_release_notes(&version::deno(), &install_version);
"Release notes: https://github.com/denoland/deno/releases/tag/v", }
&install_version,
);
log::info!(
"{}{}",
"Blog post: https://deno.com/blog/v",
get_minor_version(&install_version)
);
} }
Ok(()) Ok(())