Skip to content

Commit 9fc2748

Browse files
committed
Add dry run mode to xtask release
1 parent 082dd87 commit 9fc2748

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

xtask/src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,13 @@ fn rm_rf(path: &Path) -> Result<()> {
158158
.with_context(|| format!("failed to remove {:?}", path))
159159
}
160160

161-
pub fn run_release() -> Result<()> {
162-
run!("git switch release")?;
163-
run!("git fetch upstream")?;
164-
run!("git reset --hard upstream/master")?;
165-
run!("git push")?;
161+
pub fn run_release(dry_run: bool) -> Result<()> {
162+
if !dry_run {
163+
run!("git switch release")?;
164+
run!("git fetch upstream")?;
165+
run!("git reset --hard upstream/master")?;
166+
run!("git push")?;
167+
}
166168

167169
let changelog_dir = project_root().join("../rust-analyzer.github.io/thisweek/_posts");
168170

xtask/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ FLAGS:
9393
run_pre_cache()
9494
}
9595
"release" => {
96+
let dry_run = args.contains("--dry-run");
9697
args.finish()?;
97-
run_release()
98+
run_release(dry_run)
9899
}
99100
_ => {
100101
eprintln!(

0 commit comments

Comments
 (0)