Skip to content

Commit abf4d87

Browse files
bors[bot]curquiza
andauthored
Merge #99
99: Add test on documentation when releasing r=curquiza a=curquiza Avoid pushing a new release to crates.io if one of the version in not updated in our docs (code-samples or README) In the CI, we received the information of the new version in the `GITHUB_REF` variable in this format: `refs/tags/vX.X.X` <img width="552" alt="Capture d’écran 2021-02-06 à 17 12 53" src="https://user-images.githubusercontent.com/20380692/107123593-a65a7680-689e-11eb-8300-710ff3572292.png"> Co-authored-by: Clémentine Urquizar <[email protected]>
2 parents c911c35 + 3ee619a commit abf4d87

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/scripts/check-release.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
22

33
# Checking if current tag matches the package version
44
current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v')
5+
major=$(echo $current_tag | cut -d '.' -f1 )
6+
minor=$(echo $current_tag | cut -d '.' -f2 )
7+
cropped_current_tag="$major.$minor"
58
file1='Cargo.toml'
69
file2='src/lib.rs'
10+
file3='.code-samples.meilisearch.yaml'
11+
file4='README.md'
712

813
file_tag1=$(grep '^version = ' $file1 | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
914
file_tag2=$(grep '//! meilisearch-sdk = ' $file2 | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
10-
if [ "$current_tag" != "$file_tag1" ] || [ "$current_tag" != "$file_tag2" ]; then
15+
file_tag3=$(grep 'meilisearch-sdk = ' $file3 | cut -d '=' -f 2 | tr -d '"' | tr -d ' ')
16+
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" || "$cropped_current_tag" != "$file_tag4" ]; then
1118
echo "Error: the current tag does not match the version in package file(s)."
1219
echo "$file1: found $file_tag1 - expected $current_tag"
1320
echo "$file2: found $file_tag2 - expected $current_tag"
21+
echo "$file3: found $file_tag3 - expected $cropped_current_tag"
22+
echo "$file4: found $file_tag4 - expected $cropped_current_tag"
1423
exit 1
1524
fi
1625

0 commit comments

Comments
 (0)