From dddc7287f5552732fe3b16f8d11b42e5493d369a Mon Sep 17 00:00:00 2001 From: Eugene Lozovoy Date: Tue, 28 May 2024 17:11:09 +0300 Subject: [PATCH] 1716905469 --- action.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/action.yml b/action.yml index 2380a05..aa618b2 100644 --- a/action.yml +++ b/action.yml @@ -158,3 +158,21 @@ runs: DATE=$(rustc --version --verbose | sed -ne 's/^commit-date: \(20[0-9][0-9]\)-\([01][0-9]\)-\([0-3][0-9]\)$/\1\2\3/p') HASH=$(rustc --version --verbose | sed -ne 's/^commit-hash: //p') echo "cachekey=$(echo $DATE$HASH | head -c12)" >> $GITHUB_OUTPUT + + - name: Downgrade registry access protocol when needed + shell: bash + run: | + # Not all versions support setting CARGO_REGISTRIES_CRATES_IO_PROTOCOL + # On versions 1.66, 1.67, and 1.68.0-nightly the value "sparse" is still unstable. + # https://github.com/dtolnay/rust-toolchain/pull/69#discussion_r1107268108 + # If we detect an incompatible value, set it to "git" which is always supported. + if [[ "${{steps.versions.outputs.rustc-version}}" =~ ^rustc\ (1\.6[67]\.|1\.68\.0-nightly) && "${CARGO_REGISTRIES_CRATES_IO_PROTOCOL}" == "sparse" ]]; then + echo "Downgrade cargo registry protocol to git" + echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=git" >> $GITHUB_ENV + fi + + - name: Setup Rust Caching + if: inputs.cache == 'true' + uses: Swatinem/rust-cache@v2 + with: + workspaces: ${{inputs.cache-workspaces}}