Polishing README (#43)

* Remove repeated cargo publish

* Headings and table of contents
This commit is contained in:
Mieszko Grodzicki 2023-04-24 05:02:09 +02:00 committed by GitHub
parent 93cab96796
commit 3dda4826a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,13 @@ Lint your crate API changes for semver violations.
run: # your `cargo publish` code here run: # your `cargo publish` code here
``` ```
# Input options * [Input options](#input-options)
* [Example scenarios](#example-scenarios)
* [Use in workspaces with a single crate](#use-in-workspaces-with-a-single-crate)
* [Use in workspaces with more than one crate](#use-in-workspaces-with-more-than-one-crate)
* [Customizing baseline rustdoc caching strategy](#customizing-baseline-rustdoc-caching-strategy)
## Input options
Every argument is optional. Every argument is optional.
@ -24,7 +30,9 @@ Every argument is optional.
| `prefix-key` | Additional prefix of the cache key, can be set to start a new cache manually. | | | `prefix-key` | Additional prefix of the cache key, can be set to start a new cache manually. | |
| `github-token` | The `GITHUB_TOKEN` secret used to download precompiled binaries from GitHub API. If not specified, the [automatic GitHub token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) provided to the workflow will be used. The token may be alternatively passed in an environment variable `GITHUB_TOKEN`. | `${{ github.token }}` | | `github-token` | The `GITHUB_TOKEN` secret used to download precompiled binaries from GitHub API. If not specified, the [automatic GitHub token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) provided to the workflow will be used. The token may be alternatively passed in an environment variable `GITHUB_TOKEN`. | `${{ github.token }}` |
# Use in workspaces with a single crate ## Example scenarios
### Use in workspaces with a single crate
The action will work out-of-the-box if it is run inside the package root directory. When the package location is different, you have to specify the path to its `Cargo.toml` file: The action will work out-of-the-box if it is run inside the package root directory. When the package location is different, you have to specify the path to its `Cargo.toml` file:
```yaml ```yaml
@ -32,11 +40,9 @@ The action will work out-of-the-box if it is run inside the package root directo
uses: obi1kenobi/cargo-semver-checks-action@v2 uses: obi1kenobi/cargo-semver-checks-action@v2
with: with:
manifest-path: semver/my-crate/Cargo.toml # or just semver/my-crate/ manifest-path: semver/my-crate/Cargo.toml # or just semver/my-crate/
- name: Publish my-crate to crates.io
run: # your `cargo publish` code here
``` ```
# Use in workspaces with more than one crate ### Use in workspaces with more than one crate
By default, if workspace contains multiple crates, all of them are checked for semver violations. You can specify one or more crates to be checked instead using `package`, `exclude` or `manifest-path`. By default, if workspace contains multiple crates, all of them are checked for semver violations. You can specify one or more crates to be checked instead using `package`, `exclude` or `manifest-path`.
@ -46,8 +52,6 @@ For example, this will check `my-crate-api` and `my-crate-core`:
uses: obi1kenobi/cargo-semver-checks-action@v2 uses: obi1kenobi/cargo-semver-checks-action@v2
with: with:
package: my-crate-api, my-crate-core package: my-crate-api, my-crate-core
- name: Publish my-crate to crates.io
run: # your `cargo publish` code here
``` ```
And this will process all crates from the current workspace except `my-crate-tests`: And this will process all crates from the current workspace except `my-crate-tests`:
```yaml ```yaml
@ -55,8 +59,6 @@ And this will process all crates from the current workspace except `my-crate-tes
uses: obi1kenobi/cargo-semver-checks-action@v2 uses: obi1kenobi/cargo-semver-checks-action@v2
with: with:
exclude: my-crate-tests exclude: my-crate-tests
- name: Publish my-crate to crates.io
run: # your `cargo publish` code here
``` ```
If the action is not run inside the workspace root directory, you again have to specify the path to its `Cargo.toml` file: If the action is not run inside the workspace root directory, you again have to specify the path to its `Cargo.toml` file:
@ -65,8 +67,6 @@ If the action is not run inside the workspace root directory, you again have to
uses: obi1kenobi/cargo-semver-checks-action@v2 uses: obi1kenobi/cargo-semver-checks-action@v2
with: with:
manifest-path: semver/my-workspace/Cargo.toml # or just semver/my-workspace/ manifest-path: semver/my-workspace/Cargo.toml # or just semver/my-workspace/
- name: Publish my-workspace to crates.io
run: # your `cargo publish` code here
``` ```
The two above might be also used together: The two above might be also used together:
@ -76,11 +76,9 @@ The two above might be also used together:
with: with:
manifest-path: semver/my-workspace/Cargo.toml # or just semver/my-workspace/ manifest-path: semver/my-workspace/Cargo.toml # or just semver/my-workspace/
package: my-crate package: my-crate
- name: Publish my-crate to crates.io
run: # your `cargo publish` code here
``` ```
# Customizing baseline rustdoc caching strategy ## Customizing baseline rustdoc caching strategy
The action caches the baseline rustdoc for each package in the workspace. The keys used to distinguish the caches consist of four components: The action caches the baseline rustdoc for each package in the workspace. The keys used to distinguish the caches consist of four components: