diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d75e4ce9..b27fd6466 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,7 @@ jobs: run: just --version & shfmt --version & protoc --version shell: cmd if: startsWith(matrix.os, 'windows') - # We use the version output to check the version of binstall, but they + # We use the version output to check the version of cargo-binstall, but they # several times change the version output format in the past so we need to # check it with CI. (e.g., 0.14.0->0.16.0 update change it # from "cargo-binstall " to "") diff --git a/CHANGELOG.md b/CHANGELOG.md index f957bf29f..e9ccfb2a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Add `fallback: none` input option to ensure that fallback is not used. ([#517](https://github.com/taiki-e/install-action/pull/517)) + - `cargo-nextest` installation no longer use `cargo-binstall`. This improves security, performance, robustness of installation. See [#487](https://github.com/taiki-e/install-action/issues/487) for more. diff --git a/README.md b/README.md index 1839e31ff..7b1df19d1 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,18 @@ See [TOOLS.md](TOOLS.md) for the list of tools that are installed from manifests If a tool not included in the list above is specified, this action uses [cargo-binstall] as a fallback. +If you want to ensure that fallback is not used, use `fallback: none`. + +```yaml +- uses: taiki-e/install-action@v2 + with: + tool: cargo-hack + # Possible values: + # - none: disable all fallback + # - cargo-binstall (default): cargo-binstall (includes quickinstall) + fallback: none +``` + ### Add support for new tool See the [development guide](DEVELOPMENT.md) for how to add support for new tool. @@ -93,6 +105,8 @@ Additionally, we also verify signature if the tool distributes signed archives. See the linked documentation for information on security when installed using [snap](https://snapcraft.io/docs) or [cargo-binstall](https://github.com/cargo-bins/cargo-binstall#faq). +See the [Supported tools section](#supported-tools) for how to ensure that fallback is not used. + ## Compatibility This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Fedora, CentOS, Alma, openSUSE, Arch, Alpine). diff --git a/TOOLS.md b/TOOLS.md index 438d09407..5c3e4f829 100644 --- a/TOOLS.md +++ b/TOOLS.md @@ -4,6 +4,8 @@ This is a list of tools that are installed from manifests managed in this action If a tool not included in the list below is specified, this action uses [cargo-binstall] as a fallback. +See the [Supported tools section in README.md](README.md#supported-tools) for how to ensure that fallback is not used. + > If `$CARGO_HOME/bin` is not available, Rust-related binaries will be installed to `$HOME/.cargo/bin`.
> If `$HOME/.cargo/bin` is not available, Rust-related binaries will be installed to `/usr/local/bin`.
> If `/usr/local/bin` is not available, binaries will be installed to `$HOME/.install-action/bin`.
diff --git a/action.yml b/action.yml index c0fb6d8e6..47c8a59e9 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,10 @@ inputs: description: Whether to enable checksums required: false default: 'true' + fallback: + description: Whether to use fallback (none or cargo-binstall) + required: false + default: 'cargo-binstall' # Note: # - inputs.* should be manually mapped to INPUT_* due to https://github.com/actions/runner/issues/665 @@ -22,3 +26,4 @@ runs: env: INPUT_TOOL: ${{ inputs.tool }} INPUT_CHECKSUM: ${{ inputs.checksum }} + INPUT_FALLBACK: ${{ inputs.fallback }} diff --git a/main.sh b/main.sh index 791db2560..b061a402a 100755 --- a/main.sh +++ b/main.sh @@ -439,6 +439,12 @@ case "${enable_checksum}" in *) bail "'checksum' input option must be 'true' or 'false': '${enable_checksum}'" ;; esac +fallback="${INPUT_FALLBACK:-}" +case "${fallback}" in + none | cargo-binstall) ;; + *) bail "'fallback' input option must be 'none' or 'cargo-binstall': '${fallback}'" ;; +esac + # Refs: https://github.com/rust-lang/rustup/blob/HEAD/rustup-init.sh base_distro="" exe="" @@ -791,6 +797,9 @@ done if [[ ${#unsupported_tools[@]} -gt 0 ]]; then IFS=',' + case "${fallback}" in + none) bail "install-action does not support ${unsupported_tools[*]} (fallback is disabled by 'fallback: none' input option)" ;; + esac info "install-action does not support ${unsupported_tools[*]}; fallback to cargo-binstall" IFS=$'\n\t' install_cargo_binstall