Skip to content

Commit e8230cb

Browse files
authored
Try #422:
2 parents c717030 + 855531d commit e8230cb

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

.github/scripts/check-release.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,39 @@
22

33
# Checking if current tag matches the package version
44
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -r 's/^v//')
5-
major=$(echo $current_tag | cut -d '.' -f1 )
6-
minor=$(echo $current_tag | cut -d '.' -f2 )
5+
major=$(echo $current_tag | cut -d '.' -f1)
6+
minor=$(echo $current_tag | cut -d '.' -f2)
77
cropped_current_tag="$major.$minor"
88
file1='Cargo.toml'
99
file2='README.tpl'
1010
file3='.code-samples.meilisearch.yaml'
1111
file4='README.md'
12+
file5='./meilisearch-index-setting-macro/Cargo.toml'
1213

1314
file_tag1=$(grep '^version = ' $file1 | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
15+
file_tag_1_1=$(grep '{ path = "meilisearch-index-setting-macro", version =' $file1 | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
1416
file_tag2=$(grep 'meilisearch-sdk = ' $file2 | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
1517
file_tag3=$(grep 'meilisearch-sdk = ' $file3 | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
1618
file_tag4=$(grep 'meilisearch-sdk = ' $file4 | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
17-
if [ "$current_tag" != "$file_tag1" ] || [ "$current_tag" != "$file_tag2" ] || [ "$cropped_current_tag" != "$file_tag3" ] || [ "$current_tag" != "$file_tag4" ]; then
19+
file_tag5=$(grep '^version = ' $file5 | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
20+
file_tag5_1=$(grep '{ path = \"..\", version =' $file5 | grep -Eo '[0-9]+.[0-9]+.[0-9]+')
21+
22+
if [ "$current_tag" != "$file_tag1" ] ||
23+
[ "$current_tag" != "$file_tag_1_1" ] ||
24+
[ "$current_tag" != "$file_tag2" ] ||
25+
[ "$cropped_current_tag" != "$file_tag3" ] ||
26+
[ "$current_tag" != "$file_tag4" ] ||
27+
[ "$current_tag" != "$file_tag5" ] ||
28+
[ "$current_tag" != "$file_tag5_1" ] \
29+
; then
1830
echo "Error: the current tag does not match the version in package file(s)."
1931
echo "$file1: found $file_tag1 - expected $current_tag"
32+
echo "$file1: found $file_tag_1_1 - expected $current_tag"
2033
echo "$file2: found $file_tag2 - expected $current_tag"
2134
echo "$file3: found $file_tag3 - expected $cropped_current_tag"
2235
echo "$file4: found $file_tag4 - expected $current_tag"
36+
echo "$file5: found $file_tag5 - expected $current_tag"
37+
echo "$file5: found $file_tag5_1 - expected $current_tag"
2338
exit 1
2439
fi
2540

CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ Make a PR modifying the file [`Cargo.toml`](/Cargo.toml):
173173
version = "X.X.X"
174174
```
175175

176+
After the changes on `Cargo.toml`, run the following command:
177+
178+
```
179+
sh scripts/update_macro_versions.sh
180+
```
181+
176182
and the [`README.tpl`](/README.tpl):
177183

178184
```rust
@@ -181,13 +187,13 @@ and the [`README.tpl`](/README.tpl):
181187

182188
with the right version.
183189

184-
You should run the following command after the changes applied to `lib.rs`:
190+
After the changes on `lib.rs`, run the following command:
185191

186192
```bash
187193
sh scripts/update-readme.sh
188194
```
189195

190-
Also, you might need to change the [code-samples file](/.code-samples.meilisearch.yaml) if the minor has been upgraded:
196+
You might need to change the [code-samples file](/.code-samples.meilisearch.yaml) if the minor has been upgraded:
191197

192198
```yml
193199
meilisearch-sdk = "X.X"

scripts/update_macro_versions.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
new_version=$(cat Cargo.toml | grep '^version = ')
3+
4+
# Updates the versions in meilisearch-rust and meilisearch-index-setting-macro of the latter, with the latest meilisearch-rust version.
5+
6+
old_index_macro_version=$(cat ./meilisearch-index-setting-macro/Cargo.toml | grep '^version = ')
7+
old_sdk_in_macro_version=$(cat ./meilisearch-index-setting-macro/Cargo.toml | grep 'meilisearch-sdk = { path = "..", version = ')
8+
old_macro_in_sdk_version=$(cat ./Cargo.toml | grep '{ path = "meilisearch-index-setting-macro", version =')
9+
10+
sed -i '' -e "s/^$old_index_macro_version/$new_version/g" './meilisearch-index-setting-macro/Cargo.toml'
11+
sed -i '' -e "s/^$old_sdk_in_macro_version/meilisearch-sdk = { path = \"..\", $new_version }/g" './meilisearch-index-setting-macro/Cargo.toml'
12+
sed -i '' -e "s/$old_macro_in_sdk_version/meilisearch-index-setting-macro = { path = \"meilisearch-index-setting-macro\", $new_version }/g" './Cargo.toml'

0 commit comments

Comments
 (0)