-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrelease-version.sh
executable file
·74 lines (62 loc) · 1.93 KB
/
release-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
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
clear
# print and exec command
function run(){
echo ">$*"
if eval "$@"; then
echo [success]
else
echo [FAILED]
exit 1
fi
echo
}
./checker.sh -a
echo
echo
# filter only files that diff with origin/develop
FILESLIST=$(find . -type f | grep -e .md -e .html)
FILESLIST_COUNT=$(find . -type f | grep -e .md -e .html | wc -l)
function parse_config_file(){
local line key val
while IFS= read -r line; do
read -r key <<< "${line%% *}"
read -r val <<< "${line#* }"
if [[ -z "$val" ]]; then
continue
else
val=$(echo $val | tr -d '=' | tr -d '"' | tr -d ' ')
fi
case "$key" in
anychart-version)
ANYCHART_VERSION=${val};;
locales-version)
LOCALES_VERSION=${val};;
geodata-version)
GEODATA_VERSION=${val};;
themes-version)
THEMES_VERSION=${val};;
esac
done
}
run "parse_config_file < './config.toml'"
echo "ANYCHART_VERSION : '${ANYCHART_VERSION}'"
echo "LOCALES_VERSION : '${LOCALES_VERSION}'"
echo "GEODATA_VERSION : '${GEODATA_VERSION}'"
echo "THEMES_VERSION : '${THEMES_VERSION}'"
echo
# for each files in tree of folders do (like python walk)
nr=0
for filename in ${FILESLIST}; do
(( ++nr ))
# in diff mode file may be marked as deleted
if [ -f $filename ];then
echo -ne "${nr} / ${FILESLIST_COUNT} > ${filename} \r"
perl -pi -e "s,(releases)/(\{\{branch-name\}\})+/,\1/$ANYCHART_VERSION/,g" ${filename}
perl -pi -e "s,(geodata)/([0-9]+\.[0-9]+\.[0-9]+)/,\1/$GEODATA_VERSION/,g" ${filename}
# perl -pi -e "s,(locale)/([0-9]+\.[0-9]+\.[0-9]+)/,\1/$LOCALES_VERSION/,g" ${filename}
# perl -pi -e "s,(themes)/([0-9]+\.[0-9]+\.[0-9]+)/,\1/$THEMES_VERSION/,g" ${filename}
fi
done
# cause echo -ne previous
echo