Add dry run mode to xtask release

This commit is contained in:
Aleksey Kladov 2020-02-14 18:33:30 +01:00
parent 082dd87b32
commit 9fc2748d47
2 changed files with 9 additions and 6 deletions

View file

@ -158,11 +158,13 @@ fn rm_rf(path: &Path) -> Result<()> {
.with_context(|| format!("failed to remove {:?}", path))
}
pub fn run_release() -> Result<()> {
pub fn run_release(dry_run: bool) -> Result<()> {
if !dry_run {
run!("git switch release")?;
run!("git fetch upstream")?;
run!("git reset --hard upstream/master")?;
run!("git push")?;
}
let changelog_dir = project_root().join("../rust-analyzer.github.io/thisweek/_posts");

View file

@ -93,8 +93,9 @@ FLAGS:
run_pre_cache()
}
"release" => {
let dry_run = args.contains("--dry-run");
args.finish()?;
run_release()
run_release(dry_run)
}
_ => {
eprintln!(