diff options
-rw-r--r-- | docs/dev/README.md | 3 | ||||
-rw-r--r-- | xtask/src/release.rs | 55 |
2 files changed, 33 insertions, 25 deletions
diff --git a/docs/dev/README.md b/docs/dev/README.md index 9b9b18102..d6fae5295 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md | |||
@@ -218,8 +218,7 @@ Release steps: | |||
218 | * makes a GitHub release | 218 | * makes a GitHub release |
219 | * pushes VS Code extension to the marketplace | 219 | * pushes VS Code extension to the marketplace |
220 | * create new changelog in `rust-analyzer.github.io` | 220 | * create new changelog in `rust-analyzer.github.io` |
221 | * create `rust-analyzer.github.io/git.log` file with the log of merge commits since last release | 221 | 2. While the release is in progress, fill in the changelog |
222 | 2. While the release is in progress, fill-in the changelog using `git.log` | ||
223 | 3. Commit & push the changelog | 222 | 3. Commit & push the changelog |
224 | 4. Tweet | 223 | 4. Tweet |
225 | 5. Inside `rust-analyzer`, run `cargo xtask promote` -- this will create a PR to rust-lang/rust updating rust-analyzer's submodule. | 224 | 5. Inside `rust-analyzer`, run `cargo xtask promote` -- this will create a PR to rust-lang/rust updating rust-analyzer's submodule. |
diff --git a/xtask/src/release.rs b/xtask/src/release.rs index 93079b369..63556476d 100644 --- a/xtask/src/release.rs +++ b/xtask/src/release.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | use std::fmt::Write; | ||
2 | |||
1 | use xshell::{cmd, cp, pushd, read_dir, write_file}; | 3 | use xshell::{cmd, cp, pushd, read_dir, write_file}; |
2 | 4 | ||
3 | use crate::{codegen, date_iso, is_release_tag, project_root, Mode, Result}; | 5 | use crate::{codegen, date_iso, is_release_tag, project_root, Mode, Result}; |
@@ -24,6 +26,34 @@ impl ReleaseCmd { | |||
24 | let commit = cmd!("git rev-parse HEAD").read()?; | 26 | let commit = cmd!("git rev-parse HEAD").read()?; |
25 | let changelog_n = read_dir(changelog_dir.as_path())?.len(); | 27 | let changelog_n = read_dir(changelog_dir.as_path())?.len(); |
26 | 28 | ||
29 | for &adoc in [ | ||
30 | "manual.adoc", | ||
31 | "generated_assists.adoc", | ||
32 | "generated_config.adoc", | ||
33 | "generated_diagnostic.adoc", | ||
34 | "generated_features.adoc", | ||
35 | ] | ||
36 | .iter() | ||
37 | { | ||
38 | let src = project_root().join("./docs/user/").join(adoc); | ||
39 | let dst = website_root.join(adoc); | ||
40 | cp(src, dst)?; | ||
41 | } | ||
42 | |||
43 | let tags = cmd!("git tag --list").read()?; | ||
44 | let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap(); | ||
45 | |||
46 | let git_log = cmd!("git log {prev_tag}..HEAD --merges --reverse").read()?; | ||
47 | let mut git_log_summary = String::new(); | ||
48 | for line in git_log.lines() { | ||
49 | let line = line.trim_start(); | ||
50 | if let Some(p) = line.find(':') { | ||
51 | if let Ok(pr) = line[..p].parse::<u32>() { | ||
52 | writeln!(git_log_summary, "* pr:{}[]{}", pr, &line[p + 1..]).unwrap(); | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
27 | let contents = format!( | 57 | let contents = format!( |
28 | "\ | 58 | "\ |
29 | = Changelog #{} | 59 | = Changelog #{} |
@@ -40,39 +70,18 @@ https://github.com/sponsors/rust-analyzer[GitHub Sponsors]. | |||
40 | 70 | ||
41 | == New Features | 71 | == New Features |
42 | 72 | ||
43 | * pr:[] . | 73 | {} |
44 | 74 | ||
45 | == Fixes | 75 | == Fixes |
46 | 76 | ||
47 | == Internal Improvements | 77 | == Internal Improvements |
48 | ", | 78 | ", |
49 | changelog_n, commit, today | 79 | changelog_n, commit, today, git_log_summary |
50 | ); | 80 | ); |
51 | 81 | ||
52 | let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n)); | 82 | let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n)); |
53 | write_file(&path, &contents)?; | 83 | write_file(&path, &contents)?; |
54 | 84 | ||
55 | for &adoc in [ | ||
56 | "manual.adoc", | ||
57 | "generated_assists.adoc", | ||
58 | "generated_config.adoc", | ||
59 | "generated_diagnostic.adoc", | ||
60 | "generated_features.adoc", | ||
61 | ] | ||
62 | .iter() | ||
63 | { | ||
64 | let src = project_root().join("./docs/user/").join(adoc); | ||
65 | let dst = website_root.join(adoc); | ||
66 | cp(src, dst)?; | ||
67 | } | ||
68 | |||
69 | let tags = cmd!("git tag --list").read()?; | ||
70 | let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap(); | ||
71 | |||
72 | let git_log = cmd!("git log {prev_tag}..HEAD --merges --reverse").read()?; | ||
73 | let git_log_dst = website_root.join("git.log"); | ||
74 | write_file(git_log_dst, &git_log)?; | ||
75 | |||
76 | Ok(()) | 85 | Ok(()) |
77 | } | 86 | } |
78 | } | 87 | } |