-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathversion-and-tag-automation.sh
executable file
·96 lines (68 loc) · 2.73 KB
/
version-and-tag-automation.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env sh
set -e
function sedi {
if [[ "$(uname)" == "Linux" ]]; then
sed -i "$@"
else
sed -i "" "$@"
fi
}
echo "Welcome to the automated versioning and tagging of the SMS-Parser Android project"
newVersionCode=0
# If versionCode is set with = (ex. versionCode = X) change {print $2} to {print $3}
currentVersionCode=$(awk '/ext.versionCode/ {print $3}' ./build.gradle)
echo "Current versionCode is: $currentVersionCode"
echo "Incrementing versionCode by 1 ..."
# If versionCode is set with = (ex. versionCode = X) change {print $2} to {print $3}
for entry in `awk '/ext.versionCode/ {print $3}' ./build.gradle`; do
index=`echo ${entry}`
sedi 's/ext.versionCode [0-9a-zA-Z -_]*/ext.versionCode = '$(($index + 1))'/' ./build.gradle
done
# If versionCode is set with = (ex. versionCode = X) change {print $2} to {print $3}
newVersionCode=$(awk '/ext.versionCode =/ {print $3}' ./build.gradle)
echo "New versionCode is: $newVersionCode"
# If versionName is set with = (ex. versionName = "X.X.X") change {print $2} to {print $3}
currentVersionName=$(awk '/ext.versionName/ {print $3}' ./build.gradle)
echo "Current versionName is: $currentVersionName"
echo "Please type in the new versionName: "
read -r newVersionName
echo "Setting new versionName..."
sedi 's/ext.versionName [0-9a-zA-Z -_]*/ext.versionName = "'"$newVersionName"'"/' ./build.gradle
echo "New versionName is: $newVersionName"
currentBranch=$(git symbolic-ref --short -q HEAD)
echo "$currentBranch"
git add build.gradle
echo "Staged changes in build.gradle"
git commit -m 'Bump up version'
echo "Commited build.gradle changes"
git tag "$newVersionName"
echo "Set new tag: $newVersionName"
git checkout master
git merge develop
git push origin
git checkout develop
git push origin
git push --tags
echo "Pushed changes and tag to $currentBranch and merged changes into master"
cat << "EOF"
______________________
< Who you Gonna Call >
----------------------
\ __---__
_- /--______
__--( / \ )XXXXXXXXXXX\v.
.-XXX( O O )XXXXXXXXXXXXXXX-
/XXX( U ) XXXXXXX\
/XXXXX( )--_ XXXXXXXXXXX\
/XXXXX/ ( O ) XXXXXX \XXXXX\
XXXXX/ / XXXXXX \__ \XXXXX
XXXXXX__/ XXXXXX \__---->
---___ XXX__/ XXXXXX \__ /
\- --__/ ___/\ XXXXXX / ___--/=
\-\ ___/ XXXXXX '--- XXXXXX
\-\/XXX\ XXXXXX /XXXXX
\XXXXXXXXX \ /XXXXX/
\XXXXXX > _/XXXXX/
\XXXXX--__/ __-- XXXX/
-XXXXXXXX--------------- XXXXXX-
EOF