-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrelease.sh
executable file
·61 lines (45 loc) · 1.37 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
#!/bin/sh
#
# this has only been lightly tested on a mac with z shell, it runs a bunch
# of prechecks for fore, before uploading to maven central
#
# only use this if you've read the script
# and you understand what it is doing!
#
# chmod u+x release.sh
# ./release.sh ui|unit|both
#
# exit the script if any statement returns a non-true return value
set -e;
# echo an error message before exiting
trap ' if [ $? != 0 ]; then say -v Moira "hey, something is borked"; fi ' EXIT
TESTS_TO_RUN=$1
print_usage() {
echo "usage: ./release.sh ui|unit|both"
}
check_parameter_present() {
if [ -z $TESTS_TO_RUN ]; then
echo "no parameters specified"
print_usage ;
exit 1
fi
}
check_parameter_valid() {
if [[ "$TESTS_TO_RUN" != "ui" && "$TESTS_TO_RUN" != "unit" && "$TESTS_TO_RUN" != "both" ]]; then
echo "unrecognised parameters"
print_usage ;
exit 1
fi
}
check_parameter_present
check_parameter_valid
./gradlew clean
if [[ "$TESTS_TO_RUN" == "unit" || "$TESTS_TO_RUN" == "both" ]]; then
./gradlew testDebugUnitTest
fi
if [[ "$TESTS_TO_RUN" == "ui" || "$TESTS_TO_RUN" == "both" ]]; then
./gradlew connectedAndroidTest -PtestBuildType=debug --no-daemon --no-parallel
fi
./gradlew publishToMavenLocal
./gradlew publishReleasePublicationToMavenCentralRepository --no-daemon --no-parallel
say -v Moira "Hi, the release has been pushed to maven central"