Skip to content

Commit ad0b42b

Browse files
committed
Refine common-setup in CI
1 parent 2d43e47 commit ad0b42b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.github/actions/common-setup/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,25 @@ runs:
4747

4848
# > --------------------------------------------------
4949
# > Rust
50+
- name: Reset and update Rust toolchain
51+
shell: bash
52+
run: |
53+
if command -v rustup &> /dev/null; then
54+
rustup self update
55+
rustup update --force
56+
fi
57+
58+
- name: Get Rust toolchain version
59+
id: rust-toolchain
60+
shell: bash
61+
run: |
62+
echo "TOOLCHAIN=$(bash scripts/rust-toolchain.sh)" >> $GITHUB_ENV
63+
5064
# https://github.com/actions-rust-lang/setup-rust-toolchain
5165
- name: Set up Rust toolchain
5266
uses: actions-rust-lang/setup-rust-toolchain@v1
5367
with:
68+
toolchain: ${{ env.TOOLCHAIN }}
5469
components: clippy,rustfmt
5570
override: true
5671

scripts/rust-toolchain.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
awk -F'"' '/version[[:space:]]*=/{gsub(/[[:space:]]/,"",$2); print $2; exit}' rust-toolchain.toml

0 commit comments

Comments
 (0)