diff --git a/xtask/src/main.rs b/xtask/src/main.rs index f7a79362d95..f447613d430 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -17,7 +17,7 @@ use xtask::{ install::{ClientOpt, InstallCmd, ServerOpt}, not_bash::pushd, pre_commit, project_root, - release::ReleaseCmd, + release::{PromoteCmd, ReleaseCmd}, run_clippy, run_fuzzer, run_pre_cache, run_rustfmt, Result, }; @@ -105,6 +105,11 @@ FLAGS: args.finish()?; ReleaseCmd { dry_run }.run() } + "promote" => { + let dry_run = args.contains("--dry-run"); + args.finish()?; + PromoteCmd { dry_run }.run() + } "dist" => { let nightly = args.contains("--nightly"); let client_version: Option = args.opt_value_from_str("--client")?; diff --git a/xtask/src/release.rs b/xtask/src/release.rs index 46992c1cacd..d2d769099d6 100644 --- a/xtask/src/release.rs +++ b/xtask/src/release.rs @@ -69,3 +69,16 @@ Release: release:{}[] Ok(()) } } + +pub struct PromoteCmd { + pub dry_run: bool, +} + +impl PromoteCmd { + pub fn run(self) -> Result<()> { + run!("git switch release")?; + run!("git fetch upstream")?; + run!("git reset --hard upstream/release")?; + Ok(()) + } +}