Translation update done using Pootle.
[phpmyadmin-themes.git] / scripts / create-release.sh
blob88c008f9a7b5b6c739da5ec3dbf7d5597f03dbcb
1 #!/bin/sh
3 # vim: expandtab sw=4 ts=4 sts=4:
6 # More documentation about making a release is available at:
7 # http://wiki.phpmyadmin.net/pma/Devel:Releasing
9 # Fail on undefined variables
10 set -u
11 # Fail on failure
12 set -e
14 KITS="all-languages english"
15 COMPRESSIONS="zip-7z tbz tgz 7z"
17 if [ $# -lt 2 ]
18 then
19 echo "Usages:"
20 echo " create-release.sh <version> <from_branch> [--tag]"
21 echo ""
22 echo "If --tag is specified, relase tag is automatically created"
23 echo ""
24 echo "Examples:"
25 echo " create-release.sh 2.9.0-rc1 QA_2_9"
26 echo " create-release.sh 2.9.0 MAINT_2_9_0 --tag"
27 exit 65
31 # Checks whether remote branch has local tracking branch
32 ensure_local_branch() {
33 if ! git branch | grep -q '^..'"$1"'$' ; then
34 git branch --track $1 origin/$1
38 # Marks current head of given branch as head of other branch
39 # Used for STABLE/TESTING tracking
40 mark_as_release() {
41 branch=$1
42 rel_branch=$2
43 echo "* Marking release as $rel_branch"
44 ensure_local_branch $rel_branch
45 git checkout $rel_branch
46 git merge -s recursive -X theirs $branch
49 # Read required parameters
50 version=$1
51 shift
52 branch=$1
53 shift
55 cat <<END
57 Please ensure you have:
58 1. incremented rc count or version in the repository :
59 - in libraries/Config.class.php PMA_Config::__constructor() the line
60 " \$this->set( 'PMA_VERSION', '$version' ); "
61 - in Documentation.html the 2 lines
62 " <title>phpMyAdmin $version - Documentation</title> "
63 " <h1>phpMyAdmin $version Documentation</h1> "
64 - in translators.html
65 - in README
66 2. checked that all language files are valid (use
67 the "./scripts/check_lang.php" script to do it).
69 Continue (y/n)?
70 END
71 read do_release
73 if [ "$do_release" != 'y' ]; then
74 exit 100
77 # Ensure we have tracking branch
78 ensure_local_branch $branch
80 # Create working copy
81 mkdir -p release
82 workdir=release/phpMyAdmin-$version
83 if [ -d $workdir ] ; then
84 echo "Working directory '$workdir' already exists, please move it out of way"
85 exit 1
87 git clone --local . $workdir
88 cd $workdir
90 # Checkout branch
91 ensure_local_branch $branch
92 git checkout $branch
94 # Check release version
95 if ! grep -q "'PMA_VERSION', '$version'" libraries/Config.class.php ; then
96 echo "There seems to be wrong version in libraries/Config.class.php!"
97 exit 2
99 if ! grep -q "phpMyAdmin $version - Documentation" Documentation.html ; then
100 echo "There seems to be wrong version in Documentation.html"
101 exit 2
103 if ! grep -q "phpMyAdmin $version - Official translators" translators.html ; then
104 echo "There seems to be wrong version in translators.html"
105 exit 2
107 if ! grep -q "Version $version\$" README ; then
108 echo "There seems to be wrong version in README"
109 exit 2
112 # Cleanup release dir
113 LC_ALL=C date -u > RELEASE-DATE-${version}
115 # Building Documentation.txt
116 echo "* Generating Documentation.txt"
117 LC_ALL=C w3m -dump Documentation.html > Documentation.txt
119 # Check for gettext support
120 if [ -d po ] ; then
121 GETTEXT=1
122 else
123 GETTEXT=0
126 # Generate mo files
127 if [ $GETTEXT -eq 1 ] ; then
128 echo "* Generating mo files"
129 ./scripts/generate-mo
132 if [ -f ./scripts/compress-js ] ; then
133 echo "* Compressing javascript files"
134 ./scripts/compress-js
137 # Remove test directory from package to avoid Path disclosure messages
138 # if someone runs /test/wui.php and there are test failures
139 rm -rf test
141 # Remove javascript compiler, no need to ship it
142 rm -rf scripts/google-javascript-compiler/
144 # Remove git metadata
145 rm -rf .git
146 find . -name .gitignore -print0 | xargs -0 -r rm -f
148 cd ..
150 # Prepare all kits
151 for kit in $KITS ; do
152 # Copy all files
153 name=phpMyAdmin-$version-$kit
154 cp -r phpMyAdmin-$version $name
156 # Cleanup translations
157 cd phpMyAdmin-$version-$kit
158 scripts/lang-cleanup.sh $kit
159 cd ..
161 # Prepare distributions
162 for comp in $COMPRESSIONS ; do
163 case $comp in
164 tbz|tgz)
165 echo "* Creating $name.tar"
166 tar cf $name.tar $name
167 if [ $comp = tbz ] ; then
168 echo "* Creating $name.tar.bz2"
169 bzip2 -9k $name.tar
171 if [ $comp = tgz ] ; then
172 echo "* Creating $name.tar.gz"
173 gzip -9c $name.tar > $name.tar.gz
175 rm $name.tar
177 zip)
178 echo "* Creating $name.zip"
179 zip -q -9 -r $name.zip $name
181 zip-7z)
182 echo "* Creating $name.zip"
183 7za a -bd -tzip $name.zip $name > /dev/null
186 echo "* Creating $name.7z"
187 7za a -bd $name.7z $name > /dev/null
190 echo "WARNING: ignoring compression '$comp', not known!"
192 esac
193 done
195 # Remove directory with current dist set
196 rm -rf $name
197 done
199 # Cleanup
200 rm -rf phpMyAdmin-${version}
203 echo ""
204 echo ""
205 echo ""
206 echo "Files:"
207 echo "------"
209 ls -la *.gz *.zip *.bz2 *.7z
211 cd ..
214 if [ $# -gt 0 ] ; then
215 echo
216 echo "Additional tasks:"
217 while [ $# -gt 0 ] ; do
218 param=$1
219 case $1 in
220 --tag)
221 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
222 echo "* Tagging release as $tagname"
223 git tag -a -m "Released $version" $tagname $branch
224 if echo $version | grep -q '^2\.11\.' ; then
225 echo '* 2.11 branch, no STABLE/TESTING update'
226 else
227 if echo $version | grep '[a-z_-]' ; then
228 mark_as_release $branch TESTING
229 else
230 # We update both branches here
231 # As it does not make sense to have older testing than stable
232 mark_as_release $branch TESTING
233 mark_as_release $branch STABLE
235 git checkout master
237 echo " Dont forget to push tags using: git push --tags"
240 echo "Unknown parameter: $1!"
241 exit 1
242 esac
243 shift
244 done
245 echo
248 cat <<END
251 Todo now:
252 ---------
254 1. If not already done, tag the repository with the new revision number
255 for a plain release or a release candidate:
256 version 2.7.0 gets two tags: RELEASE_2_7_0 and STABLE
257 version 2.7.1-rc1 gets RELEASE_2_7_1RC1 and TESTING
259 2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
260 this release and paste into it the ChangeLog for this release
261 3. upload the files to SF, you can use scripts/upload-release, eg.:
263 ./scripts/upload-release \$USER $version release
264 4. add SF news item to phpMyAdmin project
265 5. announce release on freshmeat (http://freshmeat.net/projects/phpmyadmin/)
266 6. send a short mail (with list of major changes) to
267 phpmyadmin-devel@lists.sourceforge.net
268 phpmyadmin-news@lists.sourceforge.net
269 phpmyadmin-users@lists.sourceforge.net
271 Don't forget to update the Description section in the announcement,
272 based on Documentation.html.
274 7. increment rc count or version in the repository :
275 - in libraries/Config.class.php PMA_Config::__constructor() the line
276 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
277 - in Documentation.html the 2 lines
278 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
279 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
280 - in translators.html
282 8. add a group for bug tracking this new version, at
283 https://sourceforge.net/tracker/admin/index.php?group_id=23067&atid=377408&add_group=1
285 9. the end :-)