Skip to content

Commit 7932a2d

Browse files
committed
Get Rust version from Cargo.toml
1 parent 98bcbde commit 7932a2d

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
@@ -112,11 +112,22 @@ jobs:
112112
path: rewatch/target
113113
key: rewatch-build-v3-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }}
114114

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

0 commit comments

Comments
 (0)