-
Notifications
You must be signed in to change notification settings - Fork 12
/
releasehelper.sh
62 lines (51 loc) · 1.39 KB
/
releasehelper.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
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <branch>"
exit 1
fi
BRANCH="$1"
case "$BRANCH" in
"stable")
;;
"beta")
;;
"canary")
;;
"madness")
;;
*)
echo "Invalid Branch!"
exit 1
;;
esac
GITBRANCH="ci-build-$BRANCH"
git checkout origin/"$GITBRANCH" gradle.properties
VERSION=$(git log -1 --pretty=%h origin/"$GITBRANCH")
VERSION_CODE=$(cat gradle.properties | grep 'magisk.versionCode' | cut -f2 -d '=')
STUB_VERSION_CODE=$(cat gradle.properties | grep 'magisk.stubVersion' | cut -f2 -d '=')
RELEASETYPE="debug"
case "$BRANCH" in
"stable" | "beta")
VERSION=v$(echo $VERSION_CODE | cut -c1-2).$(echo $VERSION_CODE | cut -c1-2 --complement)
RELEASETYPE="release"
;;
*)
;;
esac
cat <<EOF > "$BRANCH.json"
{
"magisk": {
"version": "${VERSION}",
"versionCode": "${VERSION_CODE}",
"link": "https://raw.githubusercontent.com/programminghoch10/Lygisk/deploy/${BRANCH}/app-${RELEASETYPE}.apk",
"note": "https://raw.githubusercontent.com/programminghoch10/Lygisk/deploy/${BRANCH}/note.md"
},
"stub": {
"versionCode": "${STUB_VERSION_CODE}",
"link": "https://raw.githubusercontent.com/programminghoch10/Lygisk/deploy/${BRANCH}/stub-release.apk"
}
}
EOF
echo "Lygisk $BRANCH Update $VERSION ($VERSION_CODE)
Build date: $(date -u -R)" > note.md
rm gradle.properties