diff --git a/CHANGELOG.md b/CHANGELOG.md index 997762c..3903da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add new parameter `cache-key` that is propagated to `Swatinem/rust-cache` as `key` (#41 by @iainlane) * Make rustup toolchain installation more robust in light of planned changes https://github.com/rust-lang/rustup/issues/3635 and https://github.com/rust-lang/rustup/pull/3985 * Allow installing multiple Rust toolchains by specifying multiple versions in the `toolchain` input parameter. +* Configure the `rustup override` behavior via the new `override` input. (#38) ## [1.9.0] - 2024-06-08 diff --git a/README.md b/README.md index 6cacb74..12aca64 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a | `cache-key` | Propagates the value to [`Swatinem/rust-cache`] as `key` | | | `matcher` | Enable problem matcher to surface build messages and formatting issues | true | | `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" | +| `override` | Setup the last installed toolchain as the default via `rustup override` | true | [`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache diff --git a/action.yml b/action.yml index 240e88a..21ef752 100644 --- a/action.yml +++ b/action.yml @@ -46,6 +46,10 @@ inputs: description: "set RUSTFLAGS environment variable, set to empty string to avoid overwriting build.rustflags" required: false default: "-D warnings" + override: + description: "Setup the last installed toolchain as the default via `rustup override`" + required: false + default: "true" outputs: rustc-version: @@ -132,6 +136,7 @@ runs: toolchain: ${{inputs.toolchain}} targets: ${{inputs.target}} components: ${{inputs.components}} + override: ${{inputs.override}} shell: bash run: | if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" ) ]] @@ -154,7 +159,10 @@ runs: fi rustup toolchain install ${toolchain//,/ } ${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update # Take the last element from the list - rustup override set ${toolchain//*,/ } + if [[ "$override" == "true" ]] + then + rustup override set ${toolchain//*,/ } + fi fi - id: versions