-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbump-version.sh
executable file
·60 lines (49 loc) · 1.47 KB
/
bump-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
#!/usr/bin/env bash
DIR="."
previousVersion="1.1.1"
newVersion="1.2.0"
function replaceInFile () {
filePath=$1
if grep -q "$previousVersion" "$fname"; then
echo "-> found something to replace..."
vim -c "%s/$previousVersion/$newVersion/gc" -c 'wq' "$fname"
else
echo "-> Nothing to replace."
fi
}
echo "You are trying to bump the version number."
echo "This process should only be done in the release/x-y-z branch, with a proper version number."
echo "Please remember to update the 'previousVersion' and 'newVersion' variables (currenty hardcoded on purpose)."
echo "Current values:"
echo "* previousVersion: $previousVersion"
echo "* newVersion: $newVersion"
echo ""
echo "Looping through docs ($DIR/*.md) ..."
for fname in $(find "$DIR" -iname "*.md" -print); do
#for fname in **/**.md; do
read -p "Inspect file $fname ? (Y/n/q) ";
if [ "$REPLY" == "n" ];
then
echo "Skipped."
elif [ "$REPLY" == "q" ];
then
echo "Exiting"
exit 0
else
replaceInFile $fname
fi
done
echo ""
fname='gradle.properties'
read -p "Should we update $fname ? (Y/n/q) ";
if [ "$REPLY" == "n" -o "$REPLY" == "q" ];
then
echo "Exiting"
exit 0
else
replaceInFile $fname
fi
echo ""
echo "Please take the time to go through all remaining matchs of the previous version !"
read -p "-> grep --exclude-dir=.git --exclude-dir=build --exclude-dir=out -nr $previousVersion $DIR"
grep --exclude-dir=.git --exclude-dir=build --exclude-dir=out -nr $previousVersion $DIR