https://github.com/mwrites/cargo-publish-workspace
Cargo command to publish a workspace
https://github.com/mwrites/cargo-publish-workspace
cargo cargo-subcommand crates publish rust
Last synced: about 2 months ago
JSON representation
Cargo command to publish a workspace
- Host: GitHub
- URL: https://github.com/mwrites/cargo-publish-workspace
- Owner: mwrites
- Created: 2023-04-05T14:02:56.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-16T21:57:45.000Z (about 1 year ago)
- Last Synced: 2025-03-18T16:13:58.319Z (2 months ago)
- Topics: cargo, cargo-subcommand, crates, publish, rust
- Language: Rust
- Homepage: https://crates.io/crates/cargo-publish-workspace-v2
- Size: 23.4 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cargo publish-workspace
This tool extends Cargo to allow you to publish a workspace, a rust mono repo.
## Installation
Ensure that you have a fairly recent version of rust/cargo installed. On Ubuntu you would also need to install `libssl-dev` and `pkg-config` packages.
```console,ignore
$ cargo install cargo-publish-workspace-v2
```## Usage
```console
$ cargo publish-workspace --help
Usage: cargo publish-workspace [OPTIONS] --crate-prefix [-- ...]Arguments:
[cargo-publish-args]... Additional arguments to pass to 'cargo publish'Options:
-p, --crate-prefix The prefix of the crates to publish, e.g. 'my-repo-crate-'
--dry-run Run without publishing, same as --show-order
--show-order Only display the order of crates to be published
--target-version Specify the version to use instead of CI_TAG environment variable
--aligned-versions-only Verify that every Cargo.toml version are aligned with the version to publish
--token Specify the token to use instead of CARGO_REGISTRY_TOKEN environment variable
--exclude Crates to exclude and not modify (arg can be supplied multiple times)
--verify-upload-retries The number of retries to attempt when verifying the upload of a crate [default: 30]
-h, --help Print help
-V, --version Print version
```## Examples
Publish
```console
$ cd my-mono-repo
$ cargo publish-workspace --target-version 1.0.0 --token CARGO_REGISTRY_TOKEN --crate-prefix PREFIX
```Dry run and show order of crates to be published
```console
$ cd my-mono-repo
$ cargo publish-workspace --crate-prefix mat-clockwork --show-order
```
```console
Finished show dependencies order
0. mat-clockwork-utils
1. mat-clockwork-cron
2. mat-clockwork-thread-program-v1
3. mat-clockwork-network-program
```Excluding a crate from being published
```console
cargo publish-workspace --target-version 1.0.0 --token CARGO_REGISTRY_TOKEN --crate-prefix PREFIX --exclude crate-1 --exclude crate-2
```
> You can also set `publish = false` in the crate Cargo.toml## Publishing From GitHub Action
This tool has been made to work with a CI such as GitHub Action.
Make sure to setup the GitHub secrets variable for `CARGO_REGISTRY_TOKEN` with the appropriate value.
- Version will be inferred from the $CI_TAG environment variable
- Token will be inferred from the $CARGO_REGISTRY_TOKEN environment variable
```console
cargo publish-workspace --crate-prefix PREFIX
```## License
Apache-2.0/MIT