Skip to content

Commit

Permalink
feat(cli): add the publish subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
sbosnick committed Aug 2, 2020
1 parent 29e45da commit fd80e64
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<impl AsRef<Path>>) -> 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
Expand Down
13 changes: 12 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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)]
Expand All @@ -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())?),
}
}
}
Expand Down

0 comments on commit fd80e64

Please sign in to comment.