From c6ed756dbc3573c385bb6ed14e9da49f20e37c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20Urquizar?= Date: Tue, 21 Jun 2022 10:46:32 +0200 Subject: [PATCH] Update script after review --- .github/scripts/check-release.sh | 34 ++++++++++++++++------------ .github/scripts/is-latest-release.sh | 2 +- Cargo.lock | 2 +- permissive-json-pointer/Cargo.toml | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/scripts/check-release.sh b/.github/scripts/check-release.sh index 189019ce1..bad957cff 100644 --- a/.github/scripts/check-release.sh +++ b/.github/scripts/check-release.sh @@ -1,22 +1,26 @@ #!/bin/sh -# Checking if current tag matches the package version -current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v') -files='*/Cargo.toml' -lock_file='Cargo.lock' - - -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" +# check_tag $current_tag $file_tag $file_name +function check_tag { + if [ "$1" != "$2" ]; then + echo "Error: the current tag does not match the version in $3:" + echo "Found $1 - expected $2" 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 +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' exit 0 diff --git a/.github/scripts/is-latest-release.sh b/.github/scripts/is-latest-release.sh index af0ff45b3..81534a2f7 100644 --- a/.github/scripts/is-latest-release.sh +++ b/.github/scripts/is-latest-release.sh @@ -7,7 +7,7 @@ # Ex: previous tag -> v2.1.1 # new tag -> v1.20.3 # 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 GREP_SEMVER_REGEXP='v\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)$' # i.e. v[number].[number].[number] diff --git a/Cargo.lock b/Cargo.lock index 1bd47e355..ff2325361 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2515,7 +2515,7 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "permissive-json-pointer" -version = "0.2.0" +version = "0.28.0" dependencies = [ "big_s", "serde_json", diff --git a/permissive-json-pointer/Cargo.toml b/permissive-json-pointer/Cargo.toml index b50f30f19..9e01b81ab 100644 --- a/permissive-json-pointer/Cargo.toml +++ b/permissive-json-pointer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "permissive-json-pointer" -version = "0.2.0" +version = "0.28.0" edition = "2021" description = "A permissive json pointer" readme = "README.md"