fix: 更改cargo 配置文件的写入方式
This commit is contained in:
parent
56311d6351
commit
bd0dd7428a
63
action.yml
63
action.yml
|
|
@ -113,23 +113,60 @@ runs:
|
||||||
echo "RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup" >> $GITHUB_ENV
|
echo "RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
if [[ ! -f ~/.cargo/config ]]; then
|
if [[ ! -f ~/.cargo/config ]]; then
|
||||||
mkdir -p ~/.cargo
|
echo "[source.crates-io]" > ~/.cargo/config
|
||||||
cat > ~/.cargo/config <<EOF
|
echo "replace-with = 'rsproxy-sparse'" >> ~/.cargo/config
|
||||||
[source.crates-io]
|
echo "[source.rsproxy]" >> ~/.cargo/config
|
||||||
replace-with = 'rsproxy-sparse'
|
echo "registry = 'https://rsproxy.cn/crates.io-index'" >> ~/.cargo/config
|
||||||
|
echo "[source.rsproxy-sparse]" >> ~/.cargo/config
|
||||||
|
echo "registry = 'sparse+https://rsproxy.cn/index/'" >> ~/.cargo/config
|
||||||
|
echo "[registries.rsproxy]" >> ~/.cargo/config
|
||||||
|
echo "index = 'https://rsproxy.cn/crates.io-index'" >> ~/.cargo/config
|
||||||
|
echo "[net]" >> ~/.cargo/config
|
||||||
|
echo "git-fetch-with-cli = true" >> ~/.cargo/config
|
||||||
|
fi
|
||||||
|
|
||||||
[source.rsproxy]
|
- name: Cache Rust toolchain
|
||||||
registry = "https://rsproxy.cn/crates.io-index"
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
$HOME/.cargo/registry
|
||||||
|
$HOME/.cargo/git
|
||||||
|
$HOME/.cargo/registry/cache
|
||||||
|
$HOME/.cargo/registry/index
|
||||||
|
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-rust-
|
||||||
|
fi
|
||||||
|
|
||||||
[source.rsproxy-sparse]
|
- name: Cache Rust toolchain
|
||||||
registry = "sparse+https://rsproxy.cn/index/"
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
$HOME/.cargo/registry
|
||||||
|
$HOME/.cargo/git
|
||||||
|
$HOME/.cargo/registry/cache
|
||||||
|
$HOME/.cargo/registry/index
|
||||||
|
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock')
|
||||||
|
|
||||||
[registries.rsproxy]
|
}}
|
||||||
index = "https://rsproxy.cn/crates.io-index"
|
fi
|
||||||
|
|
||||||
[net]
|
- name: Cache Rust toolchain
|
||||||
git-fetch-with-cli = true
|
uses: actions/cache@v3
|
||||||
EOF
|
with:
|
||||||
|
path: |
|
||||||
|
$HOME/.cargo/registry
|
||||||
|
$HOME/.cargo/git
|
||||||
|
$HOME/.cargo/registry/cache
|
||||||
|
$HOME/.cargo/registry/index
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
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://rsproxy.cn/rustup-init.sh" | sh -s -- --default-toolchain none -y
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue