Merge pull request #5 from obi1kenobi/improved_docs

Improve examples for the various modes of using the action.
This commit is contained in:
Predrag Gruevski 2022-08-12 12:30:13 -04:00 committed by GitHub
commit a1d8af322f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
# cargo-semver-checks-action
A GitHub Action for running cargo-semver-checks
Lint your crate API changes for semver violations.
By default, this action assumes that:
- Your cargo workspace contains a single crate which contains a library target.
@ -13,11 +13,27 @@ Single-crate workspaces can use it as:
run: # your `cargo publish` code here
```
In a workspace with more than one crate:
- use the `crate-name` setting to specify which crate should be checked in a given run, and
- use the `version-tag-prefix` setting to override the default prefix `v` to match the way the releases of your crate are tagged. The version number `1.2.3` will be appended to this prefix.
## Use with a different version tag format
For example, this is publishing `my-crate` whose releases are tagged as `my-crate-v1.2.3`:
Change the `version-tag-prefix` setting to reflect the prefix used to create the version tag. The setting's default value `'v'` creates version tags like `v1.2.3`.
For example, if your versions are tagged as `1.2.3`, you can set `version-tag-prefix` to be the empty string:
```yaml
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v1
with:
version-tag-prefix: ''
- name: Publish my-crate to crates.io
run: # your `cargo publish` code here
```
## Use in workspaces with more than one crate
You'll need to specify which crate should be checked, and the format used for version tags for that crate:
- `crate-name` specifies the crate to check, and
- `version-tag-prefix` sets the text prepended to the version number to create the git tag for that release.
For example, this will check `my-crate` whose releases are tagged as `my-crate-v1.2.3`:
```yaml
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v1
@ -28,6 +44,8 @@ For example, this is publishing `my-crate` whose releases are tagged as `my-crat
run: # your `cargo publish` code here
```
## Use with binary crates or crates with more than one target
To check a different (non-library) target in a crate, use the `crate-target` setting:
```yaml
- name: Check semver for my_binary