# rust-build Set up Rust toolchain, configure Cargo registry, cache dependencies, run optional checks, and build via the project's `build.sh` script. ## Inputs | Input | Required | Default | Description | |-------|----------|---------|-------------| | `working-directory` | No | `.` | Directory containing `Cargo.toml` and `build.sh` | | `rust-version` | No | `1.95.0` | Rust toolchain version | | `cross-target` | No | `x86_64-unknown-linux-musl` | Cross-compilation target triple | | `build-mode` | No | `release` | Build mode — `release` or `debug` | | `run-checks` | No | `""` | Comma-separated checks to run before building — `fmt`, `clippy`, `test` | | `jfrog-token` | No | `""` | JFrog token for the Artifactory Cargo registry | ## Usage ### PR check (checks + debug build) ```yaml - uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/rust-build@rust-build-v1 with: working-directory: backend-rs build-mode: debug run-checks: fmt,clippy,test jfrog-token: ${{ secrets.JFROG_TOKEN }} ``` ### Release build ```yaml - uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/rust-build@rust-build-v1 with: working-directory: backend-rs jfrog-token: ${{ secrets.JFROG_TOKEN }} ``` ## Notes - Requires a `build.sh` in `working-directory` that accepts `--target ` and optionally `--release`. The script is responsible for running `cargo build` and copying binaries to `target/deploy/`. - Configures the Artifactory Cargo registry only if `jfrog-token` is provided. - Third-party actions used internally are pinned to exact commit SHAs to prevent supply chain attacks.