aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/release.rs
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/src/release.rs')
-rw-r--r--xtask/src/release.rs36
1 files changed, 35 insertions, 1 deletions
diff --git a/xtask/src/release.rs b/xtask/src/release.rs
index b6502b952..7fa0966aa 100644
--- a/xtask/src/release.rs
+++ b/xtask/src/release.rs
@@ -1,6 +1,6 @@
1use crate::{ 1use crate::{
2 codegen, is_release_tag, 2 codegen, is_release_tag,
3 not_bash::{date_iso, fs2, run}, 3 not_bash::{date_iso, fs2, pushd, run},
4 project_root, Mode, Result, 4 project_root, Mode, Result,
5}; 5};
6 6
@@ -37,6 +37,8 @@ Release: release:{}[]
37 37
38== Sponsors 38== Sponsors
39 39
40**Become a sponsor:** https://opencollective.com/rust-analyzer/[opencollective.com/rust-analyzer]
41
40== New Features 42== New Features
41 43
42* pr:[] . 44* pr:[] .
@@ -67,3 +69,35 @@ Release: release:{}[]
67 Ok(()) 69 Ok(())
68 } 70 }
69} 71}
72
73pub struct PromoteCmd {
74 pub dry_run: bool,
75}
76
77impl PromoteCmd {
78 pub fn run(self) -> Result<()> {
79 let _dir = pushd("../rust-rust-analyzer");
80 run!("git switch master")?;
81 run!("git fetch upstream")?;
82 run!("git reset --hard upstream/master")?;
83 run!("git submodule update --recursive")?;
84
85 let branch = format!("rust-analyzer-{}", date_iso()?);
86 run!("git switch -c {}", branch)?;
87 {
88 let _dir = pushd("src/tools/rust-analyzer");
89 run!("git fetch origin")?;
90 run!("git reset --hard origin/release")?;
91 }
92 run!("git add src/tools/rust-analyzer")?;
93 run!("git commit -m':arrow_up: rust-analyzer'")?;
94 if !self.dry_run {
95 run!("git push")?;
96 run!(
97 "xdg-open https://github.com/matklad/rust/pull/new/{}?body=r%3F%20%40ghost",
98 branch
99 )?;
100 }
101 Ok(())
102 }
103}