Skip to content

Commit a2cae4f

Browse files
authored
Check if git tag matches Cargo version when releasing (#44)
* Check if git tag matches Cargo version when releasing * Specify `bash` explicitly
1 parent a41745f commit a2cae4f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ jobs:
119119
steps:
120120
- name: Checkout
121121
uses: actions/checkout@v3
122+
- name: Check git tag against Cargo version
123+
if: startsWith(github.ref, 'refs/tags/')
124+
shell: bash
125+
run: |
126+
set -eou
127+
version=$(grep '^version' Cargo.toml | awk -F' = ' '{print $2}' | tr -d '"')
128+
version="v$version"
129+
tag='${{github.ref}}'
130+
tag="${tag#refs/tags/}"
131+
if [ "$tag" != "$version" ]; then
132+
echo "::error::Git tag doesn't match the Cargo version! ($tag != $version)"
133+
exit 1
134+
fi
122135
- name: Install dependencies
123136
if: matrix.packages != ''
124137
run: |

0 commit comments

Comments
 (0)