forked from slawkens/myaac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
65 lines (50 loc) · 1.15 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
61
62
63
64
65
#!/bin/bash
#
# myaac release script
#
# places compressed archives into releases/ directory
#
if [ $# -eq 0 ]; then
echo "No arguments supplied"
echo "Usage: release.sh prepare/pack"
exit 1
fi
if [ $1 = "prepare" ]; then
# define release version
version=`cat VERSION`
echo "Preparing to release version $version of the MyAAC Project!"
# make required directories
mkdir -p releases
mkdir -p tmp
# get myaac from git archive
git archive --format zip --output tmp/myaac.zip master
cd tmp/ || exit
dir="myaac-$version"
if [ -d "$dir" ] ; then
echo "Fatal error: Version $version already exists!!"
exit
fi
unzip -q myaac.zip -d $dir
rm myaac.zip
echo "Now you can make changes to $dir. When you are ready, type 'release.sh pack'"
exit
fi
if [ $1 = "pack" ]; then
# define release version
version=`cat VERSION`
cd tmp || exit
# tar.gz
echo "Creating .tar.gz package.."
file="myaac-$version.tar.gz"
tar -czf $file *
mv $file ../releases/
# zip
echo "Creating .zip package.."
file="myaac-$version.zip"
zip -rq $file *
mv $file ../releases/
cd ..
rm -R tmp
echo "Done. Released files can be found in 'releases' directory."
exit
fi