Skip to content

Commit 77a1308

Browse files
committed
Get Rust version from Cargo.toml
1 parent e0099ed commit 77a1308

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,22 @@ jobs:
113113
path: rewatch/target
114114
key: rewatch-build-v3-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }}
115115

116+
- name: Determine Rust toolchain version
117+
id: rust-version
118+
shell: bash
119+
run: |
120+
version="$(awk -F '"' '/^rust-version[[:space:]]*=/ { print $2; exit }' rewatch/Cargo.toml)"
121+
if [ -z "$version" ]; then
122+
echo "rust-version missing in rewatch/Cargo.toml" >&2
123+
exit 1
124+
fi
125+
echo "version=${version}" >> "$GITHUB_OUTPUT"
126+
116127
- name: Install rust toolchain
117128
if: steps.rewatch-build-cache.outputs.cache-hit != 'true'
118129
uses: dtolnay/rust-toolchain@master
119130
with:
120-
toolchain: 1.91.0
131+
toolchain: ${{ steps.rust-version.outputs.version }}
121132
targets: ${{ matrix.rust-target }}
122133
components: clippy, rustfmt
123134

0 commit comments

Comments
 (0)