CI: Fix Cargo.toml version check

This commit is contained in:
Luke Street 2024-09-04 23:51:42 -06:00
parent ce05d6d6c0
commit e1ae369d17
1 changed files with 9 additions and 7 deletions

View File

@ -29,15 +29,17 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
set -eou
version=$(grep '^version' Cargo.toml | awk -F' = ' '{print $2}' | tr -d '"')
version="v$version"
set -eou pipefail
tag='${{github.ref}}'
tag="${tag#refs/tags/}"
for file in */Cargo.toml; do
version=$(grep '^version' $file | head -1 | awk -F' = ' '{print $2}' | tr -d '"')
version="v$version"
if [ "$tag" != "$version" ]; then
echo "::error::Git tag doesn't match the Cargo version! ($tag != $version)"
exit 1
fi
done
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with: