Skip to content

Commit fe3f477

Browse files
committed
Merge branch 'cargo-target'
2 parents 93565bf + f07ebe1 commit fe3f477

File tree

6 files changed

+38
-14
lines changed

6 files changed

+38
-14
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Features
11+
12+
- Allow specifying a `--target` triple when running `cargo smart-release`, forwarding it to `cargo publish` so crates that don't
13+
compile for the host can still be released ([#89](https://github.com/GitoxideLabs/cargo-smart-release/issues/89)).
14+
815
## 0.21.8 (2025-08-03)
916

1017
### Bug Fixes
@@ -2776,4 +2783,3 @@ For more information, run `cargo changelog -h`.
27762783
## v0.1.0 (2021-08-13)
27772784

27782785
- initial release
2779-

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,29 @@ Fearlessly release workspace crates and with beautiful semi-handcrafted changelo
77
## Key Features
88

99
* **zero-configuration**
10-
* `cargo smart-release` needs no extra flags to _do the right thing™️_ smartly. If your intervention is needed it will let you know before it makes changes.
11-
* It won't do anything if there are no changes.
10+
* `cargo smart-release` needs no extra flags to _do the right thing™️_ smartly. If your intervention is needed it will let you know before it makes changes.
11+
* It won't do anything if there are no changes.
1212
* **made for multi-crate workspaces**
13-
* "Nothing stands by itself, and everything is interconnected" - is how it sees the world, allowing it to efficiently handling complex workspace graphs.
14-
* _works just as well for single-crate workspaces_
13+
* "Nothing stands by itself, and everything is interconnected" - is how it sees the world, allowing it to efficiently handling complex workspace graphs.
14+
* _works just as well for single-crate workspaces_
1515
* **changelogs-deluxe**
16-
* It maintains beautiful changelogs for you while allowing you to edit them for the final polish.
17-
* See your release notes via in-repository _tag objects_ and in _GitHub Releases_
18-
* **plays well with `cargo release`**
19-
* `cargo changelog` writes changelogs non-destructively, and only that, leaving the release workflow to [cargo-release].
20-
16+
* It maintains beautiful changelogs for you while allowing you to edit them for the final polish.
17+
* See your release notes via in-repository _tag objects_ and in _GitHub Releases_
18+
* **plays well with `cargo release`**
19+
* `cargo changelog` writes changelogs non-destructively, and only that, leaving the release workflow to [cargo-release].
20+
2121
If seeing is believing, here is [a 12 minute demonstration](https://www.youtube.com/watch?v=EOft_uMDVYE), and the same in 30 minutes is [also available](https://youtu.be/a4CzzxJ7ecE).
2222

2323
## Made for this Workflow
2424

2525
When developing various crates in a workspace, when committing changes and if the edit is breaking, a feature, or another
2626
change I want to see in changelogs, [conventional] git messages will be used. This helps building changelog scaffolding automatically later.
2727

28-
When ready for releasing a particular crate or set of crates of interest, run `cargo smart-release [<crate-name> ...]` to simulate a release. For particularly thorough
29-
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 <crate-name>`
30-
to update the scaffolding and edit it by hand until it fits.
28+
When ready for releasing a particular crate or set of crates of interest, run `cargo smart-release [<crate-name> ...]` to simulate a release.
29+
To polish changelogs, run `cargo changelog --write <crate-name>` to update the scaffolding and edit it by hand until it fits.
30+
31+
For particularly thorough but error-prone simulations (as in false positives) one could run `cargo smart-release --dry-run-cargo-publish`.
32+
Crates that don't compile for the host can be released by passing `--target <triple>`, which is forwarded to every `cargo publish` invocation (including dry runs).
3133

3234
After evaluating the release procedure and following instructions,
3335
`cargo smart-release --execute` will cause the fully automatic release of one or more crates.
@@ -39,6 +41,7 @@ There are various other options that shouldn't be needed in the common case, use
3941
## Installation
4042

4143
### Cargo
44+
4245
Via `cargo`, which can be obtained using [rustup][rustup]
4346

4447
```
@@ -87,7 +90,7 @@ Here is what `cargo smart-release` does differently: "It tries really hard to do
8790

8891
## Limitations
8992

90-
* it requires tables to be used when specifying versions, i.e. `crate = { version = "1" }` instead of `crate = "1".
93+
* it requires tables to be used when specifying versions, i.e. `crate = { version = "1" }` instead of `crate = "1".
9194
* it gracefully fails when encountering version requirement comparators which are not `^`, like `=`
9295
* it's tested only by using it on `gitoxide`, there are only very few regression tests with little coverage.
9396
* short object ids in changelogs may be ambiguous, as they are unconditionally truncated to 7 characters.
@@ -109,5 +112,7 @@ Thanks to [cargo-release] for showing the way and for incredible fast response t
109112
Special thanks go to [git-cliff] which gave me the nudge needed to want to write my own.
110113

111114
[cargo-release]: https://github.com/sunng87/cargo-release/issues/224
115+
112116
[git-cliff]: https://github.com/orhun/git-cliff
117+
113118
[rustup]: https://rustup.rs/

src/cli/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ fn main() -> anyhow::Result<()> {
6464
no_isolate_dependencies_from_breaking_changes,
6565
capitalize_commit,
6666
registry,
67+
target,
6768
signoff,
6869
commit_prefix,
6970
} => {
@@ -95,6 +96,7 @@ fn main() -> anyhow::Result<()> {
9596
allow_changelog_github_release: !no_changelog_github_release,
9697
capitalize_commit,
9798
registry,
99+
target,
98100
signoff,
99101
commit_prefix,
100102
},

src/cli/options.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ pub enum SubCommands {
152152
#[clap(long, help_heading = Some("CUSTOMIZATION"))]
153153
registry: Option<String>,
154154

155+
/// Build and package the crate for the given target triple when invoking `cargo publish`.
156+
///
157+
/// This flag is forwarded to all `cargo publish` invocations, including dry runs.
158+
#[clap(long, help_heading = Some("CUSTOMIZATION"))]
159+
target: Option<String>,
160+
155161
/// Pass --no-verify to 'cargo publish' which should only be a last resort when fixing up packages that
156162
/// otherwise wouldn't publish, but need to be publish to resolve the situation.
157163
#[clap(long, help_heading = Some("EXPERT"))]

src/command/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub mod release {
2828
pub allow_changelog_github_release: bool,
2929
pub capitalize_commit: bool,
3030
pub registry: Option<String>,
31+
pub target: Option<String>,
3132
pub signoff: bool,
3233
pub commit_prefix: Option<String>,
3334
}

src/command/release/cargo.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub(in crate::command::release_impl) fn publish_crate(
1717
no_verify,
1818
verbose,
1919
registry,
20+
target,
2021
..
2122
}: Options,
2223
) -> anyhow::Result<()> {
@@ -33,6 +34,9 @@ pub(in crate::command::release_impl) fn publish_crate(
3334
if let Some(ref registry) = registry {
3435
c.arg("--registry").arg(registry);
3536
}
37+
if let Some(ref target) = target {
38+
c.arg("--target").arg(target);
39+
}
3640

3741
if allow_dirty {
3842
c.arg("--allow-dirty");

0 commit comments

Comments
 (0)