mirror of
https://github.com/obi1kenobi/cargo-semver-checks-action.git
synced 2024-11-22 16:09:33 +01:00
Work on README
This commit is contained in:
parent
9636ecd1f2
commit
909bee2c52
2 changed files with 42 additions and 13 deletions
45
README.md
45
README.md
|
@ -14,25 +14,54 @@ Every argument is optional.
|
||||||
|
|
||||||
| Input | Description | Default |
|
| Input | Description | Default |
|
||||||
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------|---------|
|
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------|---------|
|
||||||
| github-token | The `GITHUB_TOKEN` secret, which is necessary to download precompiled binaries from GitHub API. By default, 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`. | |
|
| `package` | The package whose API to check for semver (in Package Id Specification format, see https://doc.rust-lang.org/cargo/reference/pkgid-spec.html for reference). If not set, all packages in the workspace are processed. | |
|
||||||
| package | The package whose API to check for semver (in Package Id Specification format, see https://doc.rust-lang.org/cargo/reference/pkgid-spec.html for reference). If not set, all packages in the workspace are processed. | |
|
| `manifest-path` | Path to Cargo.toml of crate or workspace to check. | |
|
||||||
| manifest-path | Path to Cargo.toml of crate or workspace to check. Has an effect only if `package` is not specified. | |
|
| `verbose` | Enables verbose output of `cargo-semver-checks`. | `false` |
|
||||||
| verbose | Enables verbose output of `cargo-semver-checks`. | `false` |
|
| `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`. | |
|
||||||
|
|
||||||
# Scenarios
|
# Use in workspaces with a single crate
|
||||||
|
|
||||||
- [Use in workspaces with more than one crate](#use-in-workspaces-with-more-than-one-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:
|
||||||
|
```yaml
|
||||||
|
- name: Check semver for my-crate
|
||||||
|
uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||||
|
with:
|
||||||
|
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 a single crate to be checked instead using `package` or `manifest-path`.
|
By default, if workspace contains multiple crates, all of them are checked for semver violations. You can specify a single crate to be checked instead using `package` or `manifest-path`.
|
||||||
|
|
||||||
For example, this will check `my-crate`:
|
For example, this will check `my-crate`:
|
||||||
```yaml
|
```yaml
|
||||||
- name: Check semver
|
- name: Check semver for my-crate from the current workspace
|
||||||
uses: obi1kenobi/cargo-semver-checks-action@v2
|
uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||||
with:
|
with:
|
||||||
package: my-crate
|
package: my-crate
|
||||||
- name: Publish my-crate to crates.io
|
- name: Publish my-crate to crates.io
|
||||||
run: # your `cargo publish` code here
|
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:
|
||||||
|
```yaml
|
||||||
|
- name: Check semver for all crates from my-workspace
|
||||||
|
uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||||
|
with:
|
||||||
|
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:
|
||||||
|
```yaml
|
||||||
|
- name: Check semver for my-crate from my-workspace
|
||||||
|
uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||||
|
with:
|
||||||
|
manifest-path: semver/my-workspace/Cargo.toml # or just semver/my-workspace/
|
||||||
|
package: my-crate
|
||||||
|
- name: Publish my-crate to crates.io
|
||||||
|
run: # your `cargo publish` code here
|
||||||
|
```
|
||||||
|
|
10
action.yml
10
action.yml
|
@ -4,16 +4,12 @@ branding:
|
||||||
icon: 'check-circle'
|
icon: 'check-circle'
|
||||||
color: 'green'
|
color: 'green'
|
||||||
inputs:
|
inputs:
|
||||||
github-token:
|
|
||||||
description: 'The GITHUB_TOKEN secret, which is necessary to download precompiled binaries from GitHub API. By default, the automatic GitHub token provided to the workflow will be used.'
|
|
||||||
required: false
|
|
||||||
default: ${{ github.token }}
|
|
||||||
package:
|
package:
|
||||||
description: 'The package whose API to check for semver (in Package Id Specification format, see https://doc.rust-lang.org/cargo/reference/pkgid-spec.html for reference). If not set, all packages in the workspace are processed.'
|
description: 'The package whose API to check for semver (in Package Id Specification format, see https://doc.rust-lang.org/cargo/reference/pkgid-spec.html for reference). If not set, all packages in the workspace are processed.'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
manifest-path:
|
manifest-path:
|
||||||
description: 'Path to Cargo.toml of crate or workspace to check. Has an effect only if package is not specified.'
|
description: 'Path to Cargo.toml of crate or workspace to check.'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
verbose:
|
verbose:
|
||||||
|
@ -21,6 +17,10 @@ inputs:
|
||||||
type: boolean
|
type: boolean
|
||||||
required: true
|
required: true
|
||||||
default: false
|
default: false
|
||||||
|
github-token:
|
||||||
|
description: 'The `GITHUB_TOKEN` secret used to download precompiled binaries from GitHub API. If not specified, the automatic GitHub token provided to the workflow will be used.'
|
||||||
|
required: false
|
||||||
|
default: ${{ github.token }}
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|
Loading…
Reference in a new issue