From fd80e648379b643dd54cbd608ab9879c15e15c81 Mon Sep 17 00:00:00 2001 From: Steven Bosnick Date: Sun, 2 Aug 2020 10:06:57 -0400 Subject: [PATCH] feat(cli): add the publish subcommand --- src/lib.rs | 12 ++++++++++++ src/main.rs | 13 ++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5af1c09..c824f4b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -188,6 +188,18 @@ pub fn prepare( Ok(()) } +/// Publish the publishable crates from the workspace. +/// +/// The publishable crates are the crates in the workspace other than those +/// whose `package.publish` field is set to `false` or that includes a registry other +/// than `crates.io`. +/// +/// This implments the `publish` step for `sementic-release` for a Cargo-based +/// Rust workspace. +pub fn publish(_output: impl Write, _manifest_path: Option>) -> Result<()> { + todo!() +} + /// List the packages from the workspace in the order of their dependencies. /// /// The list of pacakges will be written to `output`. If `manifest_path` is provided diff --git a/src/main.rs b/src/main.rs index 14e4be5..49e0aed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,7 +16,7 @@ use log::Level; use loggerv::{Logger, Output}; use structopt::StructOpt; -use semantic_release_rust::{list_packages, prepare, verify_conditions}; +use semantic_release_rust::{list_packages, prepare, publish, verify_conditions}; /// Run sementic-release steps in the context of a cargo based Rust project. #[derive(StructOpt)] @@ -72,6 +72,16 @@ enum Subcommand { /// This implments the `prepare` step for `semantic-release` for a Cargo-based /// Rust workspace. Prepare(PrepareOpt), + + /// Publish the Rust workspace. + /// + /// Publishing the workspace publishes each crate in the workspace to + /// crates.io except crates with the `package.publish` field set to `false` or + /// set to any registries other than just crates.io. + /// + /// This implments the `publish` step for `semantic-release` for a Cargo-based + /// Rust workspace. + Publish(CommonOpt), } #[derive(StructOpt)] @@ -98,6 +108,7 @@ impl Subcommand { ListPackages(opt) => Ok(list_packages(w, opt.manifest_path())?), VerifyConditions(opt) => Ok(verify_conditions(w, opt.manifest_path())?), Prepare(opt) => Ok(prepare(w, opt.common.manifest_path(), &opt.next_version)?), + Publish(opt) => Ok(publish(w, opt.manifest_path())?), } } }