Set up your GitHub Actions workflow with a specific version of Rust
Find a file
firebadnofire 7f6d8717f1
Some checks failed
Basic validation / Basic validation (push) Failing after 5s
Check dist / Check dist (push) Failing after 5s
Validate setup-rust / Rust beta on ubuntu-latest (push) Failing after 5s
Validate setup-rust / Rust stable on ubuntu-latest (push) Failing after 5s
Validate setup-rust / Rust toolchain file (push) Failing after 5s
Validate setup-rust / Rust beta on macos-latest (push) Has been cancelled
Validate setup-rust / Rust stable on macos-latest (push) Has been cancelled
Validate setup-rust / Rust beta on windows-latest (push) Has been cancelled
Validate setup-rust / Rust stable on windows-latest (push) Has been cancelled
Add setup-rust action
2026-04-28 10:16:06 -04:00
.github/workflows Add setup-rust action 2026-04-28 10:16:06 -04:00
dist/setup Add setup-rust action 2026-04-28 10:16:06 -04:00
.gitignore Add setup-rust action 2026-04-28 10:16:06 -04:00
action.yml Add setup-rust action 2026-04-28 10:16:06 -04:00
LICENSE Initial commit 2026-04-28 13:36:18 +00:00
README.md Add setup-rust action 2026-04-28 10:16:06 -04:00

setup-rust

Set up a Rust toolchain in a workflow with rustup.

Usage

steps:
  - uses: https://github.com/actions/checkout@v6
  - uses: https://pubcode.archuser.org/actions/setup-rust@main
    with:
      rust-version: stable
      components: rustfmt, clippy
      targets: wasm32-unknown-unknown

Use a toolchain file instead of an inline version:

steps:
  - uses: https://github.com/actions/checkout@v6
  - uses: https://pubcode.archuser.org/actions/setup-rust@main
    with:
      rust-version-file: rust-toolchain.toml

If neither rust-version nor rust-version-file is set, the action checks for rust-toolchain.toml, rust-toolchain, and .tool-versions in the workspace. If none exist, it installs stable.

Inputs

Input Description Default
rust-version Rust toolchain to install and use. Examples: stable, beta, nightly, 1.75.0.
rust-version-file Path to rust-toolchain, rust-toolchain.toml, or .tool-versions.
check-latest Update the selected toolchain to the latest available version. false
profile Rustup installation profile. Supported values: minimal, default, complete. minimal
components Comma or newline separated rustup components to install.
targets Comma or newline separated Rust compilation targets to install.

Outputs

Output Description
rust-version The installed rustc --version value.
rustup-toolchain The rustup toolchain selected for later steps.

Security Notes

The action uses the runner's existing rustup when available. If rustup is not installed, it downloads the official rustup installer over HTTPS with normal certificate validation:

  • Unix-like runners: https://sh.rustup.rs
  • Windows runners: https://win.rustup.rs/<arch>

The action does not disable TLS validation, does not use self-signed certificates, and does not hardcode credentials. It sets RUSTUP_TOOLCHAIN for subsequent steps instead of changing the runner's global default toolchain.

Dependency caching is intentionally not built into this action. Use a dedicated cache action in the workflow when caching Cargo directories is required.