-
Notifications
You must be signed in to change notification settings - Fork 18
/
release
executable file
·67 lines (56 loc) · 1.26 KB
/
release
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
#!/bin/bash
PRJ="VRL"
DIR="tmp"
if [ "$1" == "" ]
then
echo ">> ERROR: no command specified!"
echo ">> possible commands are: ar, push."
exit 1
fi
case "$1" in
push) echo ">> pushing archives to server"
if [ -d "$DIR" ]
then
scp tmp/* miho@mihosoft.eu:/git/releases/"$PRJ"
rm -rf "$DIR"
else
echo ">> ERROR: nothing to push!"
fi
;;
ar)
if [ "$2" == "" ]
then
echo ">> ERROR: tag not specified."
echo ">> Example: release ar v1.4.0"
exit 1
else
CWD="$(pwd)"
cd "$PRJ"
ant clean > /dev/null
cd "$CWD"
BASE="$PRJ"-"$2"-src
DOC="$PRJ"-"$2"-API-doc
BIN="$PRJ"-"$2.jar"
echo ">> creating $BASE archive..."
mkdir -p "$DIR"
git archive --format=zip --prefix="$BASE"/ "$2" "$PRJ" --output "$DIR/$BASE".zip
echo ">> building..."
cd "$DIR"
echo ">>> unpacking archive..."
unzip "$BASE".zip > /dev/null
cd "$BASE/$PRJ"
echo ">>> running doc-ant task..."
ant javadoc > /dev/null
mv dist/javadoc "$CWD/$DIR/$DOC"
echo ">>> running jar-ant task..."
ant jar > /dev/null
mv dist/VRL.jar "$CWD/$DIR/$BIN"
echo ">>> compress javadoc folder..."
cd "$CWD/$DIR"
zip -r "$DOC".zip "$DOC" > /dev/null
echo ">> cleanup..."
rm -rf "$DOC"
rm -rf "$BASE"
fi
;;
esac