/
manage.sh
executable file
·62 lines (53 loc) · 1.38 KB
/
manage.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
set -e
function unit_tests() {
mvn clean test
}
function snapshot() {
read -p "This will reset your current working tree to origin/develop, is this okay? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git fetch
git reset --hard origin/develop
echo "Deploying new release artifacts to sonatype repository."
mvn clean deploy -P release
fi
}
function release() {
read -p "This will reset your current working tree to origin/develop, is this okay? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git fetch
git reset --hard origin/develop
echo "Creating the release branch"
mvn -Prelease gitflow:release-start -DpushRemote=true
echo "Merging the release branch into develop & master, pushing changes, and tagging new version off of master"
mvn -Prelease gitflow:release-finish -DpushRemote=true
echo "Checking out latest version of master."
git fetch
git checkout origin/master
echo "Deploying new release artifacts to sonatype repository."
mvn clean deploy -P release
fi
}
case "$1" in
snapshot)
echo -n "Preparing a new snapshot version of the app..."
release
echo ""
;;
release)
echo -n "Preparing to release a new version of the app..."
release
echo ""
;;
unit-test)
echo "Starting unit tests..."
unit_tests
echo ""
;;
*)
echo "Usage: ./manage.sh release|snapshot|unit-test"
exit 1
;;
esac