xtask: Adjust release code for ruma-macros

This commit is contained in:
Jonas Platte 2023-10-24 16:19:51 +02:00
parent 2595ca5577
commit 6aa6b65258
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C

View File

@ -70,14 +70,6 @@ impl ReleaseTask {
/// Run the task to effectively create a release. /// Run the task to effectively create a release.
pub(crate) fn run(&mut self) -> Result<()> { pub(crate) fn run(&mut self) -> Result<()> {
if self.package.name == "ruma-macros" {
return Err(
"The ruma-macros crate is always released together with the ruma-common crate. \
To release both, simply run `cargo xtask release ruma-common`"
.into(),
);
}
let title = &self.title(); let title = &self.title();
let prerelease = !self.version.pre.is_empty(); let prerelease = !self.version.pre.is_empty();
let publish_only = self.package.name == "ruma-identifiers-validation"; let publish_only = self.package.name == "ruma-identifiers-validation";
@ -113,22 +105,7 @@ impl ReleaseTask {
return Ok(()); return Ok(());
} }
let mut macros = if self.package.name == "ruma-common" {
self.metadata.packages.iter().find(|p| p.name == "ruma-macros").map(ToOwned::to_owned)
} else {
None
};
let create_commit = if self.package.version != self.version { let create_commit = if self.package.version != self.version {
if let Some(m) = macros.as_mut() {
println!("Updating version of ruma-macros crate…");
m.update_version(&self.version, self.dry_run)?;
m.update_dependants(&self.metadata, self.dry_run)?;
println!("Resuming release of {}", self.title());
}
self.package.update_version(&self.version, self.dry_run)?; self.package.update_version(&self.version, self.dry_run)?;
self.package.update_dependants(&self.metadata, self.dry_run)?; self.package.update_dependants(&self.metadata, self.dry_run)?;
true true
@ -147,10 +124,6 @@ impl ReleaseTask {
self.commit()?; self.commit()?;
} }
if let Some(m) = macros {
m.publish(&self.http_client, self.dry_run)?;
}
self.package.publish(&self.http_client, self.dry_run)?; self.package.publish(&self.http_client, self.dry_run)?;
let branch = cmd!("git rev-parse --abbrev-ref HEAD").read()?; let branch = cmd!("git rev-parse --abbrev-ref HEAD").read()?;
@ -203,6 +176,13 @@ impl ReleaseTask {
println!("Release created successfully!"); println!("Release created successfully!");
if self.package.name == "ruma-macros" {
println!(
"Reminder: Make sure to release new versions of both ruma-common and ruma-events \
so users can actually start using this release"
);
}
Ok(()) Ok(())
} }