Check if git tag matches Cargo version when releasing (#44)

* Check if git tag matches Cargo version when releasing

* Specify `bash` explicitly
This commit is contained in:
Robin Avery 2024-02-28 23:15:04 -05:00 committed by GitHub
parent a41745fb97
commit a2cae4f82a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 0 deletions

View File

@ -119,6 +119,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check git tag against Cargo version
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"
tag='${{github.ref}}'
tag="${tag#refs/tags/}"
if [ "$tag" != "$version" ]; then
echo "::error::Git tag doesn't match the Cargo version! ($tag != $version)"
exit 1
fi
- name: Install dependencies
if: matrix.packages != ''
run: |