forked from phpmyadmin/themes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-release.sh
executable file
·90 lines (71 loc) · 1.57 KB
/
create-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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
set -e
usage() {
echo 'Usage: create-release.sh dir [--tag] [--upload USERNAME]'
echo
echo 'Creates a zip for themes download and optionally tags the git tree and uploads to sf.net'
}
if [ "x$1" = "x-h" -o "x$1" = "x--help" ] ; then
usage
exit 0
fi
if [ $# -eq 0 ] ; then
usage
exit 1
fi
THEME="${1%/}"
if [ ! -d "$THEME" ] ; then
echo "Directory $THEME does not exist!"
exit 2
fi
shift
TAG=0
UPLOAD=0
while [ $# -gt 0 ] ; do
case "$1" in
--tag)
TAG=1
shift
;;
--upload)
UPLOAD=1
shift
UPLOAD_USER="$1"
if [ -z "$UPLOAD_USER" ] ; then
echo "Missing sf.net username for upload!"
usage
exit 1
fi
shift
;;
*)
echo "Unknown parameter: $1"
usage
exit 1
;;
esac
done
VERSION=`php -r "include '$THEME/info.inc.php'; echo \\\$theme_full_version;"`
NAME=$THEME-$VERSION
echo "Creating release for $THEME $VERSION ($NAME)"
mkdir -p release
rm -rf release/$NAME* release/$THEME
cp -r $THEME release/$THEME
cd release
7za a -bd -tzip $NAME.zip $THEME
cd ..
echo "Release files:"
ls -la release/$NAME.zip
if [ $TAG -eq 1 ] ; then
git tag -a -m "Tagging release of theme $THEME $VERSION" $NAME
fi
if [ $UPLOAD -eq 1 ] ; then
sftp $UPLOAD_USER,[email protected] <<EOT
cd /home/frs/project/p/ph/phpmyadmin/themes
mkdir $THEME
cd $THEME
mkdir $VERSION
cd $VERSION
put release/$NAME.zip
EOT
fi