forked from SeldonIO/MLServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-version.sh
More file actions
executable file
·48 lines (36 loc) · 840 Bytes
/
update-version.sh
File metadata and controls
executable file
·48 lines (36 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail
ROOT_FOLDER="$(dirname "${0}")/.."
if [ "$#" -ne 1 ]; then
echo "Usage: ./update-version.sh <newVersion>"
exit 1
fi
_updateVersion() {
local _newVersion=$1
local _versionPy=$2
sed \
-i "s/^__version__ = \"\(.*\)\"$/__version__ = \"$_newVersion\"/" \
"$_versionPy"
}
_updateDocs() {
local _newVersion=$1
sed \
-i "s/^release = \"\(.*\)\"$/release = \"$_newVersion\"/" \
"$ROOT_FOLDER/docs/conf.py"
}
_main() {
local _newVersion=$1
# To call within `-exec`
export -f _updateVersion
find $ROOT_FOLDER \
-type f -name version.py \
\( \
-path "$ROOT_FOLDER/mlserver/*" -or \
-path "$ROOT_FOLDER/runtimes/**/*" \
\) \
-exec bash -c "_updateVersion $_newVersion {}" \;
_updateDocs $_newVersion
}
_main $1