forked from Emurgo/yoroi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-release.sh
72 lines (57 loc) · 1.66 KB
/
install-release.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
nvm i \
&& yarn install \
&& yarn setup_configs \
&& . get_commit.sh \
&& npx jetifier \
&& (cd ios; pod install)
function ask() {
read -p "$1 > " -r
if [ -z "$2" ]
then
echo $REPLY;
else
PATTERN="^$2$"
[[ $REPLY =~ $PATTERN ]]
fi
}
function ask-yn() {
ask "$1? (y/n)" "[Yy]"
}
function prompt() {
if ! ask-yn "$1"
then exit; fi
}
prompt "Android : bump";
APP_GRADLE_FILE='android/app/build.gradle'
TMP_FILE='zzzzz.tmp'
VC='versionCode'
VN='versionName'
versionCode=$(grep "$VC " $APP_GRADLE_FILE | awk '{print $2}')
versionName=$(grep "$VN " $APP_GRADLE_FILE | awk '{print $2}' | tr -d '"')
nextVersionCode=$(($versionCode + 1))
echo "Version code: ${versionCode}"
echo "Next version code: ${nextVersionCode}"
echo "Version name: ${versionName}"
nextVersionName=$(ask "Next version name? (Skip to use same)")
if [ -z ${nextVersionName} ]
then nextVersionName=${versionName}; fi
echo "Next version name: ${nextVersionName}"
OLD_VC_LINE="$VC ${versionCode}"
OLD_VN_LINE="$VN \\\"${versionName}\\\""
VC_LINE="$VC ${nextVersionCode}"
VN_LINE="$VN \\\"${nextVersionName}\\\""
awk "{sub(/$OLD_VC_LINE/,\"$VC_LINE\")}1 {sub(/$OLD_VN_LINE/,\"$VN_LINE\")}1" $APP_GRADLE_FILE > $TMP_FILE && mv $TMP_FILE $APP_GRADLE_FILE
echo "Bumped $APP_GRADLE_FILE"
prompt "Android : build";
if ask-yn "Build nightly"
then BUILD_TYPE="Nightly"; BUILD_DIR="nightly";
else
if ask-yn "Build prod"
then BUILD_TYPE="Mainnet"; BUILD_DIR="mainnet";
else echo "No build selected"; exit 1;
fi
fi
prompt "Android : building \"${BUILD_TYPE}\""
(cd android; \
ENTRY_FILE=index.ts ./gradlew clean "assemble${BUILD_TYPE}Release" \
&& open app/build/outputs/apk/${BUILD_DIR}/release)