-
Notifications
You must be signed in to change notification settings - Fork 17
/
release.sh
executable file
·88 lines (73 loc) · 1.79 KB
/
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
REL_DIR=$HOME/dev/src/java/bbct/release
BIN_REL=$REL_DIR/bin/android
SRC_REL=$REL_DIR/src/android
PREFIX=bbct-android
build_apk() {
echo Building APKs... &&
./gradlew clean assembleRelease
}
hash_apk() {
local edition=$1
local prefix=${PREFIX}-${edition}
cd ${REL_DIR}/bin/android/${edition} &&
md5sum *.apk > ${prefix}.md5 &&
echo Checking MD5... &&
md5sum -c ${prefix}.md5 &&
sha1sum *.apk > ${prefix}.sha1 &&
echo Checking SHA1... &&
sha1sum -c ${prefix}.sha1 &&
cd -
}
pull_devel() {
echo Pull devel branch... &&
git stash save 'Stash before building release' &&
git checkout devel/android &&
git pull upstream devel/android
}
archive() {
version=$1
echo Archiving source files... &&
git archive --format=zip --prefix=bbct/ -o ${SRC_REL}/bbct-lite-src.${version}.zip master lite common &&
git archive --format=tar --prefix=bbct/ master lite common | gzip > ${SRC_REL}/bbct-lite-src.${version}.tar.gz
}
checksum() {
cd ${REL_DIR}/src/android &&
md5sum *.tar.gz *.zip > $PREFIX-src.md5 &&
echo Checking MD5... &&
md5sum -c $PREFIX-src.md5 &&
sha1sum *.tar.gz *.zip > $PREFIX-src.sha1 &&
echo Checking SHA1... &&
sha1sum -c $PREFIX-src.sha1 &&
cd -
}
merge() {
echo Merge master... &&
git checkout master &&
git merge devel/android
}
tag() {
version=$1
echo Tag... &&
git tag l${version} &&
git tag p${version}
}
push() {
version=$1
echo Pushing master and tags... &&
git push origin master l${version} p${version} &&
git push upstream master l${version} p${version}
}
if [ $# == 1 ]
then {
version=$1
pull_devel &&
build_apk &&
merge &&
tag ${version} &&
push ${version}
}
else {
echo Usage: './release <version>'
}
fi