Add input release-type (#39)

This commit is contained in:
Mieszko Grodzicki 2023-04-23 20:37:51 +02:00 committed by GitHub
parent 8b981cde1a
commit 69730c4d83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 1 deletions

View file

@ -400,3 +400,21 @@ jobs:
run: rustup self uninstall -y run: rustup self uninstall -y
- name: Run the action with default arguments - name: Run the action with default arguments
uses: ./action/ uses: ./action/
test-release-type:
name: Test input release-type
runs-on: ubuntu-latest
steps:
- name: Checkout the test repository and test with major change
uses: actions/checkout@v3
with:
repository: mgr0dzicki/cargo-semver-action-ref-slice
ref: major_change
- name: Checkout the action
uses: actions/checkout@v3
with:
path: action
- name: Run the action with release-type set to major
uses: ./action/
with:
release-type: major

View file

@ -20,6 +20,7 @@ Every argument is optional.
| `exclude` | Comma-separated list of the packages that will be excluded from being processed. Has effect only if the input `package` is not specified. | | | `exclude` | Comma-separated list of the packages that will be excluded from being processed. Has effect only if the input `package` is not specified. | |
| `manifest-path` | Path to Cargo.toml of crate or workspace to check. If not specified, the action assumes the manifest is under the default [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) path. | | | `manifest-path` | Path to Cargo.toml of crate or workspace to check. If not specified, the action assumes the manifest is under the default [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) path. | |
| `verbose` | Enables verbose output of `cargo-semver-checks`. | `false` | | `verbose` | Enables verbose output of `cargo-semver-checks`. | `false` |
| `release-type` | Sets the release type instead of deriving it from the version number specified in the `Cargo.toml` file. Possible values are `major`, `minor`, `patch`. | |
| `rust-toolchain` | Rust toolchain name to use, e.g. `stable`, `nightly` or `1.68.0`. It will be installed if necessary and used regardless of local overrides and the `rust-toolchain.toml` file. However, if the input is set to `manual`, the action assumes some Rust toolchain is already installed and uses the default one. | `stable` | | `rust-toolchain` | Rust toolchain name to use, e.g. `stable`, `nightly` or `1.68.0`. It will be installed if necessary and used regardless of local overrides and the `rust-toolchain.toml` file. However, if the input is set to `manual`, the action assumes some Rust toolchain is already installed and uses the default one. | `stable` |
| `shared-key` | A cache key that will be used instead of the automatic key based on the name of the GitHub job and values of the inputs `package`, `exclude` and `manifest-path`. Might be provided e.g. to share the cache between the jobs. | | | `shared-key` | A cache key that will be used instead of the automatic key based on the name of the GitHub job and values of the inputs `package`, `exclude` and `manifest-path`. Might be provided e.g. to share the cache between the jobs. | |
| `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. | |

View file

@ -18,6 +18,13 @@ inputs:
type: boolean type: boolean
required: true required: true
default: false default: false
release-type:
description: 'Sets the release type instead of deriving it from the version number specified in the `Cargo.toml` file.'
required: false
options:
- patch
- minor
- major
rust-toolchain: rust-toolchain:
description: 'Rust toolchain name to use, e.g. `stable`, `nightly` or `1.68.0`. It will be installed if necessary and used regardless of local overrides and the `rust-toolchain.toml` file. However, if the input is set to `manual`, the action assumes some Rust toolchain is already installed and uses the default one.' description: 'Rust toolchain name to use, e.g. `stable`, `nightly` or `1.68.0`. It will be installed if necessary and used regardless of local overrides and the `rust-toolchain.toml` file. However, if the input is set to `manual`, the action assumes some Rust toolchain is already installed and uses the default one.'
default: 'stable' default: 'stable'

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -21,6 +21,7 @@ function getCheckReleaseArguments(): string[] {
optionFromList("--package", rustCore.input.getInputList("package")), optionFromList("--package", rustCore.input.getInputList("package")),
optionFromList("--exclude", rustCore.input.getInputList("exclude")), optionFromList("--exclude", rustCore.input.getInputList("exclude")),
optionIfValueProvided("--manifest-path", rustCore.input.getInput("manifest-path")), optionIfValueProvided("--manifest-path", rustCore.input.getInput("manifest-path")),
optionIfValueProvided("--release-type", rustCore.input.getInput("release-type")),
rustCore.input.getInputBool("verbose") ? ["--verbose"] : [], rustCore.input.getInputBool("verbose") ? ["--verbose"] : [],
].flat(); ].flat();
} }