Skip to content

Commit 17812b6

Browse files
committed
chore: Remove our cliff config and don't use cliff to generate changelogs
1 parent bab979a commit 17812b6

File tree

2 files changed

+1
-148
lines changed

2 files changed

+1
-148
lines changed

cliff.toml

Lines changed: 0 additions & 91 deletions
This file was deleted.

xtask/src/release.rs

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use std::env;
2-
31
use clap::{Args, Subcommand, ValueEnum};
42
use xshell::cmd;
53

6-
use crate::{sh, workspace, Result};
4+
use crate::{sh, Result};
75

86
#[derive(Args)]
97
pub struct ReleaseArgs {
@@ -36,10 +34,6 @@ enum ReleaseCommand {
3634
},
3735
/// Get a list of interesting changes that happened in the last week.
3836
WeeklyReport,
39-
/// Generate the changelog for a specific crate, this shouldn't be run
40-
/// manually, cargo-release will call this.
41-
#[clap(hide = true)]
42-
Changelog,
4337
}
4438

4539
#[derive(Clone, Copy, Debug, Default, PartialEq, ValueEnum)]
@@ -68,22 +62,10 @@ impl ReleaseArgs {
6862
pub fn run(self) -> Result<()> {
6963
check_prerequisites();
7064

71-
// The changelog needs to be generated from the directory of the crate,
72-
// `cargo-release` changes the directory for us but we need to
73-
// make sure to not switch back to the workspace dir.
74-
//
75-
// More info: https://git-cliff.org/docs/usage/monorepos
76-
let sh = sh();
77-
let _p;
78-
if self.cmd != ReleaseCommand::Changelog {
79-
_p = sh.push_dir(workspace::root_path()?);
80-
}
81-
8265
match self.cmd {
8366
ReleaseCommand::Prepare { version, execute } => prepare(version, execute),
8467
ReleaseCommand::Publish { execute } => publish(execute),
8568
ReleaseCommand::WeeklyReport => weekly_report(),
86-
ReleaseCommand::Changelog => changelog(),
8769
}
8870
}
8971
}
@@ -167,41 +149,3 @@ fn weekly_report() -> Result<()> {
167149

168150
Ok(())
169151
}
170-
171-
/// Generate the changelog for a given crate.
172-
///
173-
/// This will be called by `cargo-release` and it will set the correct
174-
/// environment and call it from within the correct directory.
175-
fn changelog() -> Result<()> {
176-
let dry_run = env::var("DRY_RUN").map(|dry| str::parse::<bool>(&dry)).unwrap_or(Ok(true))?;
177-
let crate_name = env::var("CRATE_NAME").expect("CRATE_NAME must be set");
178-
let new_version = env::var("NEW_VERSION").expect("NEW_VERSION must be set");
179-
180-
if dry_run {
181-
println!(
182-
"\nGenerating a changelog for {} (dry run), the following output will be prepended to the CHANGELOG.md file:\n",
183-
crate_name
184-
);
185-
} else {
186-
println!("Generating a changelog for {}.", crate_name);
187-
}
188-
189-
let sh = sh();
190-
let command = cmd!(sh, "git cliff")
191-
.arg("cliff")
192-
.arg("--config")
193-
.arg("../../cliff.toml")
194-
.arg("--include-path")
195-
.arg(format!("crates/{}/**/*", crate_name))
196-
.arg("--repository")
197-
.arg("../../")
198-
.arg("--unreleased")
199-
.arg("--tag")
200-
.arg(&new_version);
201-
202-
let command = if dry_run { command } else { command.arg("--prepend").arg("CHANGELOG.md") };
203-
204-
command.run()?;
205-
206-
Ok(())
207-
}

0 commit comments

Comments
 (0)