equal
deleted
inserted
replaced
|
1 #!/usr/bin/env bash |
|
2 |
|
3 set -e |
|
4 |
|
5 function usage() { |
|
6 cat <<EOF |
|
7 Usage: $0 "x.y.z" |
|
8 "x.y.z": version number, following the semver convention |
|
9 EOF |
|
10 } |
|
11 |
|
12 if [ $# -ne 1 ]; then |
|
13 echo "Bad number of parameters" |
|
14 usage >&2 |
|
15 exit 1 |
|
16 fi |
|
17 |
|
18 if [[ "$1" == "-h" || "$1" == "--help" ]]; then |
|
19 usage |
|
20 exit 0 |
|
21 fi |
|
22 |
|
23 version=$1 |
|
24 |
|
25 echo "Version: ${version}" |
|
26 |
|
27 [[ "${version}" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]] || { |
|
28 echo "Bad format for version." |
|
29 usage >&2 |
|
30 exit 1 |
|
31 } |
|
32 |
|
33 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
|
34 green="\x1B[0;32m" # '\e[1;32m' is too bright for white bg. |
|
35 blue="\x1B[1;34m" |
|
36 endColor="\x1B[0m" |
|
37 |
|
38 function echoblue() { |
|
39 echo -e "${blue}$1${endColor}" |
|
40 } |
|
41 |
|
42 pushd "$DIR" |
|
43 |
|
44 pushd ../client |
|
45 echoblue "Setting js client version" |
|
46 yarn run set-version "$version" |
|
47 popd |
|
48 |
|
49 pushd ../src |
|
50 echoblue "Setting server version" |
|
51 python3 setup.py set_version --version="$version" |
|
52 popd |
|
53 |
|
54 echoblue "Version has been changed, please commit and push if necessary." |
|
55 |
|
56 |
|
57 popd |