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.rs86
1 files changed, 47 insertions, 39 deletions
diff --git a/xtask/src/release.rs b/xtask/src/release.rs
index 771a8cf71..36c912184 100644
--- a/xtask/src/release.rs
+++ b/xtask/src/release.rs
@@ -4,56 +4,64 @@ use crate::{
4 project_root, Mode, Result, 4 project_root, Mode, Result,
5}; 5};
6 6
7pub fn run_release(dry_run: bool) -> Result<()> { 7pub struct ReleaseCmd {
8 if !dry_run { 8 pub dry_run: bool,
9 run!("git switch release")?; 9}
10 run!("git fetch upstream --tags --force")?;
11 run!("git reset --hard tags/nightly")?;
12 run!("git push")?;
13 }
14 codegen::generate_assists_docs(Mode::Overwrite)?;
15 codegen::generate_feature_docs(Mode::Overwrite)?;
16 10
17 let website_root = project_root().join("../rust-analyzer.github.io"); 11impl ReleaseCmd {
18 let changelog_dir = website_root.join("./thisweek/_posts"); 12 pub fn run(self) -> Result<()> {
13 if !self.dry_run {
14 run!("git switch release")?;
15 run!("git fetch upstream --tags --force")?;
16 run!("git reset --hard tags/nightly")?;
17 run!("git push")?;
18 }
19 codegen::generate_assists_docs(Mode::Overwrite)?;
20 codegen::generate_feature_docs(Mode::Overwrite)?;
19 21
20 let today = date_iso()?; 22 let website_root = project_root().join("../rust-analyzer.github.io");
21 let commit = run!("git rev-parse HEAD")?; 23 let changelog_dir = website_root.join("./thisweek/_posts");
22 let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();
23 24
24 let contents = format!( 25 let today = date_iso()?;
25 "\ 26 let commit = run!("git rev-parse HEAD")?;
26= Changelog #{} 27 let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();
27:sectanchors:
28:page-layout: post
29 28
30Commit: commit:{}[] + 29 let contents = format!(
31Release: release:{}[] 30 "\
31 = Changelog #{}
32 :sectanchors:
33 :page-layout: post
32 34
33== New Features 35 Commit: commit:{}[] +
36 Release: release:{}[]
34 37
35* pr:[] . 38 == New Features
36 39
37== Fixes 40 * pr:[] .
38 41
39== Internal Improvements 42 == Fixes
40",
41 changelog_n, commit, today
42 );
43 43
44 let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n)); 44 == Internal Improvements
45 fs2::write(&path, &contents)?; 45 ",
46 changelog_n, commit, today
47 );
46 48
47 for &adoc in ["manual.adoc", "generated_features.adoc", "generated_assists.adoc"].iter() { 49 let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n));
48 let src = project_root().join("./docs/user/").join(adoc); 50 fs2::write(&path, &contents)?;
49 let dst = website_root.join(adoc);
50 fs2::copy(src, dst)?;
51 }
52 51
53 let tags = run!("git tag --list"; echo = false)?; 52 for &adoc in ["manual.adoc", "generated_features.adoc", "generated_assists.adoc"].iter() {
54 let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap(); 53 let src = project_root().join("./docs/user/").join(adoc);
54 let dst = website_root.join(adoc);
55 fs2::copy(src, dst)?;
56 }
55 57
56 println!("\n git log {}..HEAD --merges --reverse", prev_tag); 58 let tags = run!("git tag --list"; echo = false)?;
59 let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap();
57 60
58 Ok(()) 61 let git_log = run!("git log {}..HEAD --merges --reverse", prev_tag; echo = false)?;
62 let git_log_dst = website_root.join("git.log");
63 fs2::write(git_log_dst, &git_log)?;
64
65 Ok(())
66 }
59} 67}