Increase theme version
[phpmyadmin-themes.git] / create-release.sh
blob1660713027b2c946af642cb792081d291535ee48
1 #!/bin/sh
3 set -e
5 usage() {
6 echo 'Usage: create-release.sh dir [--tag] [--upload USERNAME]'
7 echo
8 echo 'Creates a zip for themes download and optionally tags the git tree and uploads to sf.net'
11 if [ "x$1" = "x-h" -o "x$1" = "x--help" ] ; then
12 usage
13 exit 0
15 if [ $# -eq 0 ] ; then
16 usage
17 exit 1
20 THEME="${1%/}"
21 if [ ! -d "$THEME" ] ; then
22 echo "Directory $THEME does not exist!"
23 exit 2
26 shift
28 TAG=0
29 UPLOAD=0
31 while [ $# -gt 0 ] ; do
32 case "$1" in
33 --tag)
34 TAG=1
35 shift
37 --upload)
38 UPLOAD=1
39 shift
40 UPLOAD_USER="$1"
41 if [ -z "$UPLOAD_USER" ] ; then
42 echo "Missing sf.net username for upload!"
43 usage
44 exit 1
46 shift
49 echo "Unknown parameter: $1"
50 usage
51 exit 1
53 esac
54 done
56 VERSION=`php -r "include '$THEME/info.inc.php'; echo \\\$theme_full_version;"`
57 NAME=$THEME-$VERSION
59 echo "Creating release for $THEME $VERSION ($NAME)"
61 mkdir -p release
63 rm -rf release/$NAME* release/$THEME
65 cp -r $THEME release/$THEME
67 cd release
69 7za a -bd -tzip $NAME.zip $THEME
71 cd ..
73 echo "Release files:"
74 ls -la release/$NAME.zip
76 if [ $TAG -eq 1 ] ; then
77 git tag -a -m "Tagging release of theme $THEME $VERSION" $NAME
80 if [ $UPLOAD -eq 1 ] ; then
81 sftp $UPLOAD_USER,phpmyadmin@frs.sourceforge.net <<EOT
82 cd /home/frs/project/p/ph/phpmyadmin/themes
83 mkdir $THEME
84 cd $THEME
85 mkdir $VERSION
86 cd $VERSION
87 put release/$NAME.zip
88 EOT