diff --git a/CHANGELOG.md b/CHANGELOG.md index 03a7150..9f77912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Features + + - Allow specifying a `--target` triple when running `cargo smart-release`, forwarding it to `cargo publish` so crates that don't + compile for the host can still be released ([#89](https://github.com/GitoxideLabs/cargo-smart-release/issues/89)). + ## 0.21.8 (2025-08-03) ### Bug Fixes @@ -2776,4 +2783,3 @@ For more information, run `cargo changelog -h`. ## v0.1.0 (2021-08-13) - initial release - diff --git a/README.md b/README.md index 18f75b7..0a45485 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ When developing various crates in a workspace, when committing changes and if th change I want to see in changelogs, [conventional] git messages will be used. This helps building changelog scaffolding automatically later. When ready for releasing a particular crate or set of crates of interest, run `cargo smart-release [ ...]` to simulate a release. For particularly thorough -but error-prone simulations (as in false positives) one could run `cargo smart-release --dry-run-cargo-publish`. To polish changelogs, run `cargo changelog --write ` +but error-prone simulations (as in false positives) one could run `cargo smart-release --dry-run-cargo-publish`. Crates that don't compile for the host can be released by +passing `--target `, which is forwarded to every `cargo publish` invocation (including dry runs). To polish changelogs, run `cargo changelog --write ` to update the scaffolding and edit it by hand until it fits. After evaluating the release procedure and following instructions, diff --git a/src/cli/main.rs b/src/cli/main.rs index 37116d1..476539b 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -64,6 +64,7 @@ fn main() -> anyhow::Result<()> { no_isolate_dependencies_from_breaking_changes, capitalize_commit, registry, + target, signoff, commit_prefix, } => { @@ -95,6 +96,7 @@ fn main() -> anyhow::Result<()> { allow_changelog_github_release: !no_changelog_github_release, capitalize_commit, registry, + target, signoff, commit_prefix, }, diff --git a/src/cli/options.rs b/src/cli/options.rs index 6128979..2371994 100644 --- a/src/cli/options.rs +++ b/src/cli/options.rs @@ -152,6 +152,12 @@ pub enum SubCommands { #[clap(long, help_heading = Some("CUSTOMIZATION"))] registry: Option, + /// Build and package the crate for the given target triple when invoking `cargo publish`. + /// + /// This flag is forwarded to all `cargo publish` invocations, including dry runs. + #[clap(long, help_heading = Some("CUSTOMIZATION"))] + target: Option, + /// Pass --no-verify to 'cargo publish' which should only be a last resort when fixing up packages that /// otherwise wouldn't publish, but need to be publish to resolve the situation. #[clap(long, help_heading = Some("EXPERT"))] diff --git a/src/command/mod.rs b/src/command/mod.rs index 428be0a..9635758 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -28,6 +28,7 @@ pub mod release { pub allow_changelog_github_release: bool, pub capitalize_commit: bool, pub registry: Option, + pub target: Option, pub signoff: bool, pub commit_prefix: Option, } diff --git a/src/command/release/cargo.rs b/src/command/release/cargo.rs index 414b05d..0be2708 100644 --- a/src/command/release/cargo.rs +++ b/src/command/release/cargo.rs @@ -17,6 +17,7 @@ pub(in crate::command::release_impl) fn publish_crate( no_verify, verbose, registry, + target, .. }: Options, ) -> anyhow::Result<()> { @@ -33,6 +34,9 @@ pub(in crate::command::release_impl) fn publish_crate( if let Some(ref registry) = registry { c.arg("--registry").arg(registry); } + if let Some(ref target) = target { + c.arg("--target").arg(target); + } if allow_dirty { c.arg("--allow-dirty");