Update script after review

This commit is contained in:
Clémentine Urquizar 2022-06-21 10:46:32 +02:00
parent de16de20f4
commit c6ed756dbc
No known key found for this signature in database
GPG Key ID: D8E7CC7422E77E1A
4 changed files with 22 additions and 18 deletions

View File

@ -1,22 +1,26 @@
#!/bin/sh #!/bin/sh
# Checking if current tag matches the package version # check_tag $current_tag $file_tag $file_name
current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v') function check_tag {
files='*/Cargo.toml' if [ "$1" != "$2" ]; then
lock_file='Cargo.lock' echo "Error: the current tag does not match the version in $3:"
echo "Found $1 - expected $2"
file5=$(grep -A 1 'name = "meilisearch-auth"' $file5 | grep version)
for file in $file1 $file2 $file3 $file4 $file5;
do
file_tag=$(grep '^version = ' $file | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
if [ "$current_tag" != "$file_tag" ]; then
echo "Error: the current tag does not match the version in package file(s)."
echo "$file: found $file_tag - expected $current_tag"
exit 1 exit 1
fi fi
}
current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v')
files='*/Cargo.toml'
for file in $files;
do
file_tag="$(grep '^version = ' $file | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')"
check_tag $current_tag $file_tag $file
done done
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
echo 'OK' echo 'OK'
exit 0 exit 0

View File

@ -7,7 +7,7 @@
# Ex: previous tag -> v2.1.1 # Ex: previous tag -> v2.1.1
# new tag -> v1.20.3 # new tag -> v1.20.3
# The new tag (v1.20.3) should NOT be the latest # The new tag (v1.20.3) should NOT be the latest
# So it returns "false", the `latest tag` should not be updated for the release v1.20.3 and still need to correspond to v2.1.1 # So it returns "false", the `latest` tag should not be updated for the release v1.20.3 and still need to correspond to v2.1.1
# GLOBAL # GLOBAL
GREP_SEMVER_REGEXP='v\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)$' # i.e. v[number].[number].[number] GREP_SEMVER_REGEXP='v\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)$' # i.e. v[number].[number].[number]

2
Cargo.lock generated
View File

@ -2515,7 +2515,7 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]] [[package]]
name = "permissive-json-pointer" name = "permissive-json-pointer"
version = "0.2.0" version = "0.28.0"
dependencies = [ dependencies = [
"big_s", "big_s",
"serde_json", "serde_json",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "permissive-json-pointer" name = "permissive-json-pointer"
version = "0.2.0" version = "0.28.0"
edition = "2021" edition = "2021"
description = "A permissive json pointer" description = "A permissive json pointer"
readme = "README.md" readme = "README.md"