aboutsummaryrefslogtreecommitdiff
path: root/xtask/src/lib.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-10 14:32:03 +0000
committerAleksey Kladov <[email protected]>2020-02-10 14:34:04 +0000
commit57147d7471584e23135dff1e629a44dfd7657276 (patch)
tree514ec735d466af7257fff57c4c4740eb260accda /xtask/src/lib.rs
parent1b6acc391aee6a2c2868f537786f1dfa4ff774a2 (diff)
xtask release
Diffstat (limited to 'xtask/src/lib.rs')
-rw-r--r--xtask/src/lib.rs43
1 files changed, 42 insertions, 1 deletions
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs
index 8fdf43e4a..1bb1882b0 100644
--- a/xtask/src/lib.rs
+++ b/xtask/src/lib.rs
@@ -15,7 +15,10 @@ use std::{
15 process::{Command, Stdio}, 15 process::{Command, Stdio},
16}; 16};
17 17
18use crate::{cmd::run, codegen::Mode}; 18use crate::{
19 cmd::{run, run_with_output},
20 codegen::Mode,
21};
19 22
20pub use anyhow::Result; 23pub use anyhow::Result;
21 24
@@ -156,3 +159,41 @@ fn rm_rf(path: &Path) -> Result<()> {
156 if path.is_file() { fs::remove_file(path) } else { fs::remove_dir_all(path) } 159 if path.is_file() { fs::remove_file(path) } else { fs::remove_dir_all(path) }
157 .with_context(|| format!("failed to remove {:?}", path)) 160 .with_context(|| format!("failed to remove {:?}", path))
158} 161}
162
163pub fn run_release() -> Result<()> {
164 run("git switch release", ".")?;
165 run("git fetch upstream", ".")?;
166 run("git reset --hard upstream/master", ".")?;
167 run("git push", ".")?;
168
169 let changelog_dir = project_root().join("../rust-analyzer.github.io/thisweek/_posts");
170
171 let today = run_with_output("date --iso", ".")?;
172 let commit = run_with_output("git rev-parse HEAD", ".")?;
173 let changelog_n = fs::read_dir(changelog_dir.as_path())?.count();
174
175 let contents = format!(
176 "\
177= Changelog #{}
178:sectanchors:
179:page-layout: post
180
181Commit: commit:{}[] +
182Release: release:{}[]
183
184== New Features
185
186* pr:[] .
187
188== Fixes
189
190== Internal Improvements
191",
192 changelog_n, commit, today
193 );
194
195 let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n));
196 fs::write(&path, &contents)?;
197
198 Ok(())
199}