-
Notifications
You must be signed in to change notification settings - Fork 6
/
updateVersionInDocs.sh
executable file
·52 lines (40 loc) · 1.82 KB
/
updateVersionInDocs.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
#!/bin/sh
VERSION_PROPERTIES=version.properties
DEP_VERSIONS_PROPERTIES=dep_versions.properties
function getProperty {
PROP_FILE=$1
PROP_KEY=$2
PROP_VALUE=`cat $PROP_FILE | grep "$PROP_KEY" | cut -d'=' -f2`
echo $PROP_VALUE
}
major=$(getProperty $VERSION_PROPERTIES "major")
minor=$(getProperty $VERSION_PROPERTIES "minor")
patch=$(getProperty $VERSION_PROPERTIES "patch")
version="${major}.${minor}.${patch}"
ksp_version=$(getProperty $DEP_VERSIONS_PROPERTIES "KSP")
devkit_version="${version}-$(getProperty $DEP_VERSIONS_PROPERTIES "DEVKIT")"
java_version=$(getProperty $DEP_VERSIONS_PROPERTIES "JAVA")
java_version_=$(echo "${java_version}" | sed 's/\./_/g')
echo "Retrieving version from $VERSION_PROPERTIES: [${version}]"
echo "Retrieving KSP versions from $DEP_VERSIONS_PROPERTIES: [${ksp_version}]"
echo "Retrieving Java versions from $DEP_VERSIONS_PROPERTIES: [${java_version_}, jvm: ${java_version}]"
files="
README.md
devbricksx-java-annotations/README.md
devbricksx-kotlin-annotations/README.md
docs/sample_notebook_tutorial_01.md
"
for f in ${files}; do
if [ ! -f ${f} ]; then
continue;
fi
echo "updating version in file [${f}]..."
sed -i "" "s/devbricksx_version\ =\ \".*\"/devbricksx_version\ =\ \"${version}\"/g" ${f}
sed -i "" "s/download.svg\?version=[0-9]\.[0-9]\.[0-9]/download.svg\?version=${version}/g" ${f}
sed -i "" "s/maven\/devbricksx\/[0-9]\.[0-9]\.[0-9]\//maven\/devbricksx\/${version}\//g" ${f}
echo "updating dependencies version in file [${f}]..."
sed -i "" "s/ksp_version\ =\ \".*\"/ksp_version\ =\ \"${ksp_version}\"/g" ${f}
sed -i "" "s/devkit_version\ =\ \".*\"/devkit_version\ =\ \"${devkit_version}\"/g" ${f}
sed -i "" "s/JavaVersion.VERSION_.*/JavaVersion.VERSION_${java_version_}/g" ${f}
sed -i "" "s/jvmTarget\ =\ \".*\"/jvmTarget\ =\ \"${java_version}\"/g" ${f}
done