2022-06-23 19:14:39 +02:00
|
|
|
#!/bin/bash
|
2022-06-16 19:27:27 +02:00
|
|
|
|
2022-06-21 10:46:32 +02:00
|
|
|
# check_tag $current_tag $file_tag $file_name
|
|
|
|
function check_tag {
|
2022-06-23 19:14:39 +02:00
|
|
|
if [[ "$1" != "$2" ]]; then
|
2023-02-15 13:56:24 +01:00
|
|
|
echo "Error: the current tag does not match the version in Cargo.toml: found $2 - expected $1"
|
2022-06-22 12:20:12 +02:00
|
|
|
ret=1
|
2022-06-21 10:46:32 +02:00
|
|
|
fi
|
|
|
|
}
|
2022-06-16 19:27:27 +02:00
|
|
|
|
2022-06-22 12:20:12 +02:00
|
|
|
ret=0
|
2022-06-23 19:14:39 +02:00
|
|
|
current_tag=${GITHUB_REF#'refs/tags/v'}
|
2022-06-21 10:14:17 +02:00
|
|
|
|
2023-02-15 13:56:24 +01:00
|
|
|
file_tag="$(grep '^version = ' Cargo.toml | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')"
|
|
|
|
check_tag $current_tag $file_tag
|
2022-06-16 19:27:27 +02:00
|
|
|
|
2022-06-21 10:46:32 +02:00
|
|
|
lock_file='Cargo.lock'
|
|
|
|
lock_tag=$(grep -A 1 'name = "meilisearch-auth"' $lock_file | grep version | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
|
|
|
|
check_tag $current_tag $lock_tag $lock_file
|
|
|
|
|
2022-06-23 19:14:39 +02:00
|
|
|
if [[ "$ret" -eq 0 ]] ; then
|
2022-06-22 12:20:12 +02:00
|
|
|
echo 'OK'
|
|
|
|
fi
|
|
|
|
exit $ret
|