-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·60 lines (45 loc) · 1.28 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
#!/bin/sh
systemCall() {
echo "running $1"
if eval $1; then
echo "command [$1] ran successfully"
else
echo "command [$1] failed with exit status [$?]"
exit 1
fi
}
if grep -q "\-SNAPSHOT" "build.gradle"; then
echo "build file has SNAPSHOT in it, skipping release"
exit 0
fi
if grep -q "\-SNAPSHOT" "VERSION"; then
echo "VERSION file has SNAPSHOT in it, skipping release"
exit 0
fi
echo ""
echo "Updating dependencies in case any have changed"
echo ""
systemCall "./gradlew updateDependencies"
systemCall "git add build.gradle"
#this will fail if there is nothing to commit, let's call it directly so we can ignore failure
git commit -m 'updating dependencies'
systemCall "git push origin master"
echo ""
echo "Testing the application before releasing"
echo ""
systemCall "./gradlew test"
#releases to github
PROJECT_VERSION=`cat VERSION`
echo ""
echo "Releasing ${PROJECT_VERSION} to GitHub"
echo ""
systemCall "git tag -a v${PROJECT_VERSION} -m 'tagging release'"
systemCall "git push origin v${PROJECT_VERSION}"
#release to bintray
echo ""
echo "Releasing ${PROJECT_VERSION} to BinTray"
echo ""
systemCall "./gradlew publishArchives bumpVersion"
systemCall "git add VERSION"
systemCall "git commit -m 'committing a new version'"
systemCall "git push origin master"