From d9c91b20fd575d8e7998826de9744357e3a7a903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20M=C3=A4nnchen?= Date: Wed, 23 Apr 2025 16:16:31 +0200 Subject: [PATCH] Support rustup installation for Windows --- action.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index d3aecfe..ca44c3d 100644 --- a/action.yml +++ b/action.yml @@ -130,13 +130,20 @@ runs: run: echo "::add-matcher::${{ github.action_path }}/rust.json" - name: Install rustup, if needed - if: runner.os != 'Windows' shell: bash run: | if ! command -v rustup &> /dev/null ; then curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y - echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH + + # Resolve the correct CARGO_HOME path depending on OS + if [[ "$RUNNER_OS" == "Windows" ]]; then + echo "${CARGO_HOME:-$USERPROFILE/.cargo}/bin" | sed 's|/|\\|g' >> $GITHUB_PATH + else + echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH + fi fi + env: + RUNNER_OS: "${{ runner.os }}" - name: rustup toolchain install ${{inputs.toolchain || 'stable'}} env: