Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.

Commit 2b86ace

Browse files
committed
chore(release.sh): Ensure versions use the format X.Y.Z
1 parent 4f7963f commit 2b86ace

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

release.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
set -eo pipefail
44

5-
SELF_ROOT=$(cd $(dirname "$0") && pwd)
5+
if [ $# -ne 1 ]; then
6+
echo "$0 | A script to release new versions automatically"
7+
echo "Usage: $0 VERSION_CODE"
8+
exit -1
9+
fi
610

711
function call_sed(){
812
PATTERN="$1"
@@ -18,15 +22,18 @@ fi
1822

1923
FILE_BUILD_GRADLE="$SELF_ROOT/algoliasearch/common.gradle"
2024
FILE_API_CLIENT="$SELF_ROOT/algoliasearch/src/main/java/com/algolia/search/saas/Client.java"
25+
SELF_ROOT=$(cd $(dirname "$0") && pwd)
26+
VERSION_CODE=$1
2127

22-
if [ $# -ne 1 ]; then
23-
echo "$0 | A script to release new versions automatically"
24-
echo "Usage: $0 VERSION_CODE"
28+
set +eo pipefail
29+
COUNT_DOTS=$(grep -o "\." <<< $VERSION_CODE | wc -l)
30+
set -eo pipefail
31+
32+
if [ $COUNT_DOTS -ne 2 ]; then
33+
echo "$VERSION_CODE is not a valid version code, please use the form X.Y.Z (e.g. v1 = 1.0.0)"
2534
exit -1
2635
fi
2736

28-
VERSION_CODE=$1
29-
3037
# Check that the working repository is clean (without any changes, neither staged nor unstaged).
3138
# An exception is the change log, which should have been edited, but not necessarily committed (we usually commit it
3239
# along with the version number).

0 commit comments

Comments
 (0)