forked from vegaprotocol/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetversion.sh
More file actions
executable file
·42 lines (34 loc) · 1.28 KB
/
setversion.sh
File metadata and controls
executable file
·42 lines (34 loc) · 1.28 KB
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
#!/usr/bin/env bash
# Set version strings everywhere.
version="${1:-}"
versionregex='^[0-9]+\.[0-9]+\.[0-9]+(-(a|pre)[0-9]+)?$'
if ! echo "$version" | grep -qE "$versionregex" ; then
echo "Version does not match regex."
echo "Regex: $versionregex"
exit 1
fi
checkfile() {
file="${1:-}"
regex="${2:-}"
if ! grep -qE "$regex" "$file" ; then
echo "Failed to set version in $file"
exit 1
fi
}
# Main readme
sed --in-place -e 's#^Version: .*$#Version: '"$version"'#' README.md
checkfile README.md '^Version: '"$version"'$'
# CPP
# to be done
# Java
sed --in-place -e 's#^ <version>[^<]*</version># <version>'"$version"'</version>#' grpc/clients/java/pom.xml
checkfile grpc/clients/java/pom.xml "<version>$version</version>"
# Javascript
sed --in-place -e 's#"version": "[^"]*"#"version": "'"$version"'"#' grpc/clients/js/package.json
checkfile grpc/clients/js/package.json '"version": "'"$version"'",'
sed --in-place -e 's#^ "version": "[^"]*"# "version": "'"$version"'"#' grpc/clients/js/package-lock.json
checkfile grpc/clients/js/package-lock.json '^ "version": "'"$version"'",'
(cd grpc/clients/js && npm install)
# Python
sed --in-place -e 's#^VERSION = "[^"]*"#VERSION = "'"$version"'"#' grpc/clients/python/setup.py
checkfile grpc/clients/python/setup.py '^VERSION = "'"$version"'"'