Translated using Weblate (Slovenian)
[phpmyadmin.git] / scripts / create-release.sh
blob1dafdd2ee7c8de444d1600656e996cfbd498691c
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/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 txz tgz 7z"
17 if [ $# -lt 2 ]
18 then
19 echo "Usages:"
20 echo " create-release.sh <version> <from_branch> [--tag] [--stable]"
21 echo ""
22 echo "If --tag is specified, release tag is automatically created (do not use this on pre-release versions)"
23 echo "If --stable is specified, the STABLE branch is updated with this release"
24 echo ""
25 echo "Examples:"
26 echo " create-release.sh 2.9.0-rc1 QA_2_9"
27 echo " create-release.sh 2.9.0 MAINT_2_9_0 --tag --stable"
28 exit 65
32 # Checks whether remote branch has local tracking branch
33 ensure_local_branch() {
34 if ! git branch | grep -q '^..'"$1"'$' ; then
35 git branch --track $1 origin/$1
39 # Marks current head of given branch as head of other branch
40 # Used for STABLE tracking
41 mark_as_release() {
42 branch=$1
43 rel_branch=$2
44 echo "* Marking release as $rel_branch"
45 ensure_local_branch $rel_branch
46 git checkout $rel_branch
47 git merge -s recursive -X theirs $branch
50 # Read required parameters
51 version=$1
52 shift
53 branch=$1
54 shift
56 git checkout $branch
57 if [ -f libraries/Config.php ] ; then
58 CONFIG_LIB=libraries/Config.php
59 else
60 CONFIG_LIB=libraries/Config.class.php
62 git checkout master
64 cat <<END
66 Please ensure you have incremented rc count or version in the repository :
67 - in $CONFIG_LIB PMA\libraries\Config::__constructor() the line
68 " \$this->set( 'PMA_VERSION', '$version' ); "
69 - in doc/conf.py the line
70 " version = '$version' "
71 - in README
72 - set release date in ChangeLog
74 Continue (y/n)?
75 END
76 read do_release
78 if [ "$do_release" != 'y' ]; then
79 exit 100
82 # Ensure we have tracking branch
83 ensure_local_branch $branch
85 # Create working copy
86 mkdir -p release
87 workdir=release/phpMyAdmin-$version
88 if [ -d $workdir ] ; then
89 echo "Working directory '$workdir' already exists, please move it out of way"
90 exit 1
92 git clone --local . $workdir
93 cd $workdir
95 # Checkout branch
96 ensure_local_branch $branch
97 git checkout $branch
99 # Check release version
100 if ! grep -q "'PMA_VERSION', '$version'" $CONFIG_LIB ; then
101 echo "There seems to be wrong version in $CONFIG_LIB!"
102 exit 2
104 if test -f Documentation.html && ! grep -q "phpMyAdmin $version - Documentation" Documentation.html ; then
105 echo "There seems to be wrong version in Documentation.html"
107 if test -f doc/conf.py && ! grep -q "version = '$version'" doc/conf.py ; then
108 echo "There seems to be wrong version in doc/conf.py"
109 exit 2
111 if ! grep -q "Version $version\$" README ; then
112 echo "There seems to be wrong version in README"
113 exit 2
116 # Cleanup release dir
117 LC_ALL=C date -u > RELEASE-DATE-${version}
119 # Building documentation
120 echo "* Generating documentation"
121 if [ -f doc/conf.py ] ; then
122 LC_ALL=C make -C doc html
123 find doc -name '*.pyc' -print0 | xargs -0 -r rm -f
124 else
125 LC_ALL=C w3m -dump Documentation.html > Documentation.txt
128 # Check for gettext support
129 if [ -d po ] ; then
130 echo "* Generating mo files"
131 ./scripts/generate-mo
132 if [ -f ./scripts/remove-incomplete-mo ] ; then
133 echo "* Removing incomplete translations"
134 ./scripts/remove-incomplete-mo
136 echo "* Removing gettext source files"
137 rm -rf po
140 if [ -f ./scripts/line-counts.sh ] ; then
141 echo "* Generating line counts"
142 ./scripts/line-counts.sh
145 echo "* Removing unneeded files"
147 # Remove test directory from package to avoid Path disclosure messages
148 # if someone runs /test/wui.php and there are test failures
149 rm -rf test
151 # Remove phpcs coding standard definition
152 rm -rf PMAStandard
154 # Testsuite setup
155 rm -f build.xml phpunit.xml.dist .travis.yml .jshintrc
157 # Remove readme for github
158 rm -f README.rst
160 # Remove git metadata
161 rm -rf .git
162 find . -name .gitignore -print0 | xargs -0 -r rm -f
164 cd ..
166 # Prepare all kits
167 for kit in $KITS ; do
168 # Copy all files
169 name=phpMyAdmin-$version-$kit
170 cp -r phpMyAdmin-$version $name
172 # Cleanup translations
173 cd phpMyAdmin-$version-$kit
174 scripts/lang-cleanup.sh $kit
175 if [ -f sql/create_tables.sql ] ; then
176 # 3.5 and newer
177 rm -rf scripts
178 else
179 # 3.4 and older
180 # Remove javascript compiler, no need to ship it
181 rm -rf scripts/google-javascript-compiler/
183 # Remove scripts which are not useful for user
184 for s in generate-sprites advisor2po lang-cleanup.sh locales-contributors remove-incomplete-mo compress-js create-release.sh generate-mo remove_control_m.sh update-po upload-release ; do
185 rm -f scripts/$s
186 done
188 cd ..
190 # Remove tar file possibly left from previous run
191 rm -f $name.tar
193 # Prepare distributions
194 for comp in $COMPRESSIONS ; do
195 case $comp in
196 tbz|tgz|txz)
197 if [ ! -f $name.tar ] ; then
198 echo "* Creating $name.tar"
199 tar cf $name.tar $name
201 if [ $comp = tbz ] ; then
202 echo "* Creating $name.tar.bz2"
203 bzip2 -9k $name.tar
205 if [ $comp = txz ] ; then
206 echo "* Creating $name.tar.xz"
207 xz -9k $name.tar
209 if [ $comp = tgz ] ; then
210 echo "* Creating $name.tar.gz"
211 gzip -9c $name.tar > $name.tar.gz
214 zip)
215 echo "* Creating $name.zip"
216 zip -q -9 -r $name.zip $name
218 zip-7z)
219 echo "* Creating $name.zip"
220 7za a -bd -tzip $name.zip $name > /dev/null
223 echo "* Creating $name.7z"
224 7za a -bd $name.7z $name > /dev/null
227 echo "WARNING: ignoring compression '$comp', not known!"
229 esac
230 done
233 # Cleanup
234 rm -f $name.tar
235 # Remove directory with current dist set
236 rm -rf $name
237 done
239 # Cleanup
240 rm -rf phpMyAdmin-${version}
242 # Signing of files with default GPG key
243 echo "* Signing files"
244 for file in *.gz *.zip *.xz *.bz2 *.7z ; do
245 gpg --detach-sign --armor $file
246 md5sum $file > $file.md5
247 sha1sum $file > $file.sha1
248 done
251 echo ""
252 echo ""
253 echo ""
254 echo "Files:"
255 echo "------"
257 ls -la *.gz *.zip *.xz *.bz2 *.7z
259 cd ..
262 if [ $# -gt 0 ] ; then
263 echo
264 echo "Additional tasks:"
265 while [ $# -gt 0 ] ; do
266 param=$1
267 case $1 in
268 --tag)
269 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
270 echo "* Tagging release as $tagname"
271 git tag -a -m "Released $version" $tagname $branch
272 echo " Dont forget to push tags using: git push --tags"
274 --stable)
275 mark_as_release $branch STABLE
276 git checkout master
279 echo "Unknown parameter: $1!"
280 exit 1
281 esac
282 shift
283 done
284 echo
287 cat <<END
290 Todo now:
291 ---------
293 1. If not already done, tag the repository with the new revision number
294 for a plain release or a release candidate:
295 version 2.7.0 gets RELEASE_2_7_0
296 version 2.7.1-rc1 gets RELEASE_2_7_1RC1
298 2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
299 this release and paste into it the ChangeLog for this release, followed
300 by the notes of all previous incremental versions (i.e. 4.4.9 through 4.4.0)
301 3. upload the files to our file server, use scripts/upload-release, eg.:
303 ./scripts/upload-release $version release
304 4. add a news item to our website; a good idea is to include a link to the release notes such as https://www.phpmyadmin.net/files/4.4.10/
305 5. send a short mail (with list of major changes) to
306 developers@phpmyadmin.net
307 news@phpmyadmin.net
309 Don't forget to update the Description section in the announcement,
310 based on documentation.
312 6. increment rc count or version in the repository :
313 - in $CONFIG_LIB PMA\libraries\Config::__constructor() the line
314 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
315 - in Documentation.html (if it exists) the 2 lines
316 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
317 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
318 - in doc/conf.py (if it exists) the line
319 " version = '2.7.1-dev' "
321 7. on https://github.com/phpmyadmin/phpmyadmin/milestones close the milestone corresponding to the released version (if this is a stable release) and open a new one for the next minor release
323 8. if a maintenance version was released, delete the branch corresponding to the previous one; for example git push origin --delete MAINT_4_4_12
325 9. for a stable version, update demo/php/versions.ini in the scripts repository so that the demo server shows current versions
327 10. in case of a new major release, update the pmaweb/settings.py in website repository to include the new major releases
329 11. the end :-)