forked from SeldonIO/MLServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-version.sh
executable file
·66 lines (51 loc) · 1.2 KB
/
update-version.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/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
_updatePyproject() {
local _newVersion=$1
local _pyproject=$2
sed \
-i "s/^version = \"\(.*\)\"$/version = \"$_newVersion\"/" \
"$_pyproject"
}
_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
export -f _updatePyproject
find $ROOT_FOLDER \
-type f -name version.py \
\( \
-path "$ROOT_FOLDER/mlserver/*" -or \
-path "$ROOT_FOLDER/runtimes/**/*" \
\) \
-exec bash -c "_updateVersion $_newVersion {}" \;
find $ROOT_FOLDER \
-type f -name pyproject.toml \
\( \
-path "$ROOT_FOLDER/*" -or \
-path "$ROOT_FOLDER/runtimes/*" \
\) \
-exec bash -c "_updatePyproject $_newVersion {}" \;
_updateDocs $_newVersion
}
_main $1