|
85 | 85 | if [[ ! -v CARGO_UNSTABLE_SPARSE_REGISTRY ]]; then
|
86 | 86 | echo "CARGO_UNSTABLE_SPARSE_REGISTRY=true" >> $GITHUB_ENV
|
87 | 87 | fi
|
| 88 | + if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then |
| 89 | + echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV |
| 90 | + fi |
88 | 91 | shell: bash
|
89 | 92 | - name: "Install Rust Problem Matcher"
|
90 | 93 | run: echo "::add-matcher::${{ github.action_path }}/rust.json"
|
@@ -126,17 +129,15 @@ runs:
|
126 | 129 | echo "cachekey=$(echo $DATE$HASH | head -c12)" >> $GITHUB_OUTPUT
|
127 | 130 | shell: bash
|
128 | 131 |
|
129 |
| - # Copied from dtolnay/rust-toolchain and adapted |
130 |
| - # https://github.com/dtolnay/rust-toolchain/blob/25dc93b901a87e864900a8aec6c12e9aa794c0c3/action.yml#L100-L108 |
131 |
| - - name: "Enable cargo sparse registry on stable" |
| 132 | + - name: "Downgrade registry access protocol when needed" |
132 | 133 | run: |
|
133 |
| - # except on 1.66 and 1.67, on which it is unstable |
134 |
| - # Not all 1.68.0-nightly versions support it either |
| 134 | + # Not all versions support setting CARGO_REGISTRIES_CRATES_IO_PROTOCOL |
| 135 | + # On versions 1.66, 1.67, and 1.68.0-nightly the value "sparse" is still unstable. |
135 | 136 | # https://github.com/dtolnay/rust-toolchain/pull/69#discussion_r1107268108
|
136 |
| - if [[ ! -v CARGO_REGISTRIES_CRATES_IO_PROTOCOL ]]; then |
137 |
| - if echo "${{steps.versions.outputs.rustc-version}}" | grep --invert --quiet '^rustc \(1\.6[67]\.\|1\.68\.0-nightly\)'; then |
138 |
| - echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV |
139 |
| - fi |
| 137 | + # If we detect an incompatible value, set it to "git" which is always supported. |
| 138 | + if [[ "${{steps.versions.outputs.rustc-version}}" =~ ^rustc\ (1\.6[67]\.|1\.68\.0-nightly) && "${CARGO_REGISTRIES_CRATES_IO_PROTOCOL}" == "sparse" ]]; then |
| 139 | + echo "Downgrade cargo registry protocol to git" |
| 140 | + echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=git" >> $GITHUB_ENV |
140 | 141 | fi
|
141 | 142 | shell: bash
|
142 | 143 |
|
|
0 commit comments