diff options
Diffstat (limited to 'xtask/src/release.rs')
-rw-r--r-- | xtask/src/release.rs | 50 |
1 files changed, 12 insertions, 38 deletions
diff --git a/xtask/src/release.rs b/xtask/src/release.rs index dde5d14ee..452f351d0 100644 --- a/xtask/src/release.rs +++ b/xtask/src/release.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use std::fmt::Write; | 1 | mod changelog; |
2 | 2 | ||
3 | use xshell::{cmd, cp, pushd, read_dir, write_file}; | 3 | use xshell::{cmd, cp, pushd, read_dir, write_file}; |
4 | 4 | ||
@@ -10,7 +10,16 @@ impl flags::Release { | |||
10 | cmd!("git switch release").run()?; | 10 | cmd!("git switch release").run()?; |
11 | cmd!("git fetch upstream --tags --force").run()?; | 11 | cmd!("git fetch upstream --tags --force").run()?; |
12 | cmd!("git reset --hard tags/nightly").run()?; | 12 | cmd!("git reset --hard tags/nightly").run()?; |
13 | cmd!("git push").run()?; | 13 | // The `release` branch sometimes has a couple of cherry-picked |
14 | // commits for patch releases. If that's the case, just overwrite | ||
15 | // it. As we are setting `release` branch to an up-to-date `nightly` | ||
16 | // tag, this shouldn't be problematic in general. | ||
17 | // | ||
18 | // Note that, as we tag releases, we don't worry about "losing" | ||
19 | // commits -- they'll be kept alive by the tag. More generally, we | ||
20 | // don't care about historic releases all that much, it's fine even | ||
21 | // to delete old tags. | ||
22 | cmd!("git push --force").run()?; | ||
14 | } | 23 | } |
15 | codegen::docs()?; | 24 | codegen::docs()?; |
16 | 25 | ||
@@ -38,42 +47,7 @@ impl flags::Release { | |||
38 | let tags = cmd!("git tag --list").read()?; | 47 | let tags = cmd!("git tag --list").read()?; |
39 | let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap(); | 48 | let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap(); |
40 | 49 | ||
41 | let git_log = cmd!("git log {prev_tag}..HEAD --merges --reverse").read()?; | 50 | let contents = changelog::get_changelog(changelog_n, &commit, prev_tag, &today)?; |
42 | let mut git_log_summary = String::new(); | ||
43 | for line in git_log.lines() { | ||
44 | let line = line.trim_start(); | ||
45 | if let Some(p) = line.find(':') { | ||
46 | if let Ok(pr) = line[..p].parse::<u32>() { | ||
47 | writeln!(git_log_summary, "* pr:{}[]{}", pr, &line[p + 1..]).unwrap(); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | let contents = format!( | ||
53 | "\ | ||
54 | = Changelog #{} | ||
55 | :sectanchors: | ||
56 | :page-layout: post | ||
57 | |||
58 | Commit: commit:{}[] + | ||
59 | Release: release:{}[] | ||
60 | |||
61 | == Sponsors | ||
62 | |||
63 | **Become a sponsor:** On https://opencollective.com/rust-analyzer/[OpenCollective] or | ||
64 | https://github.com/sponsors/rust-analyzer[GitHub Sponsors]. | ||
65 | |||
66 | == New Features | ||
67 | |||
68 | {} | ||
69 | |||
70 | == Fixes | ||
71 | |||
72 | == Internal Improvements | ||
73 | ", | ||
74 | changelog_n, commit, today, git_log_summary | ||
75 | ); | ||
76 | |||
77 | let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n)); | 51 | let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n)); |
78 | write_file(&path, &contents)?; | 52 | write_file(&path, &contents)?; |
79 | 53 | ||