Translated using Weblate (Armenian)
[phpmyadmin.git] / scripts / create-release.sh
blob59d3f43e20123a982ad9a85e0def3d37107b087f
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 cat <<END
58 Please ensure you have 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 doc/conf.py the line
62 " version = '$version' "
63 - in README
65 Continue (y/n)?
66 END
67 read do_release
69 if [ "$do_release" != 'y' ]; then
70 exit 100
73 # Ensure we have tracking branch
74 ensure_local_branch $branch
76 # Create working copy
77 mkdir -p release
78 workdir=release/phpMyAdmin-$version
79 if [ -d $workdir ] ; then
80 echo "Working directory '$workdir' already exists, please move it out of way"
81 exit 1
83 git clone --local . $workdir
84 cd $workdir
86 # Checkout branch
87 ensure_local_branch $branch
88 git checkout $branch
90 # Check release version
91 if ! grep -q "'PMA_VERSION', '$version'" libraries/Config.class.php ; then
92 echo "There seems to be wrong version in libraries/Config.class.php!"
93 exit 2
95 if test -f Documentation.html && ! grep -q "phpMyAdmin $version - Documentation" Documentation.html ; then
96 echo "There seems to be wrong version in Documentation.html"
98 if test -f doc/conf.py && ! grep -q "version = '$version'" doc/conf.py ; then
99 echo "There seems to be wrong version in doc/conf.py"
100 exit 2
102 if ! grep -q "Version $version\$" README ; then
103 echo "There seems to be wrong version in README"
104 exit 2
107 # Cleanup release dir
108 LC_ALL=C date -u > RELEASE-DATE-${version}
110 # Building documentation
111 echo "* Generating documentation"
112 if [ -f doc/conf.py ] ; then
113 LC_ALL=C make -C doc html
114 find doc -name '*.pyc' -print0 | xargs -0 -r rm -f
115 else
116 LC_ALL=C w3m -dump Documentation.html > Documentation.txt
119 # Check for gettext support
120 if [ -d po ] ; then
121 echo "* Generating mo files"
122 ./scripts/generate-mo
123 if [ -f ./scripts/remove-incomplete-mo ] ; then
124 echo "* Removing incomplete translations"
125 ./scripts/remove-incomplete-mo
127 echo "* Removing gettext source files"
128 rm -rf po
131 if [ -f ./scripts/line-counts.sh ] ; then
132 echo "* Generating line counts"
133 ./scripts/line-counts.sh
136 echo "* Removing unneeded files"
138 # Remove test directory from package to avoid Path disclosure messages
139 # if someone runs /test/wui.php and there are test failures
140 rm -rf test
142 # Remove phpcs coding standard definition
143 rm -rf PMAStandard
145 # Testsuite setup
146 rm -f build.xml phpunit.xml.dist .travis.yml .jshintrc
148 # Remove readme for github
149 rm -f README.rst
151 # Remove git metadata
152 rm -rf .git
153 find . -name .gitignore -print0 | xargs -0 -r rm -f
155 cd ..
157 # Prepare all kits
158 for kit in $KITS ; do
159 # Copy all files
160 name=phpMyAdmin-$version-$kit
161 cp -r phpMyAdmin-$version $name
163 # Cleanup translations
164 cd phpMyAdmin-$version-$kit
165 scripts/lang-cleanup.sh $kit
166 if [ -f sql/create_tables.sql ] ; then
167 # 3.5 and newer
168 rm -rf scripts
169 else
170 # 3.4 and older
171 # Remove javascript compiler, no need to ship it
172 rm -rf scripts/google-javascript-compiler/
174 # Remove scripts which are not useful for user
175 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
176 rm -f scripts/$s
177 done
179 cd ..
181 # Remove tar file possibly left from previous run
182 rm -f $name.tar
184 # Prepare distributions
185 for comp in $COMPRESSIONS ; do
186 case $comp in
187 tbz|tgz|txz)
188 if [ ! -f $name.tar ] ; then
189 echo "* Creating $name.tar"
190 tar cf $name.tar $name
192 if [ $comp = tbz ] ; then
193 echo "* Creating $name.tar.bz2"
194 bzip2 -9k $name.tar
196 if [ $comp = txz ] ; then
197 echo "* Creating $name.tar.xz"
198 xz -9k $name.tar
200 if [ $comp = tgz ] ; then
201 echo "* Creating $name.tar.gz"
202 gzip -9c $name.tar > $name.tar.gz
205 zip)
206 echo "* Creating $name.zip"
207 zip -q -9 -r $name.zip $name
209 zip-7z)
210 echo "* Creating $name.zip"
211 7za a -bd -tzip $name.zip $name > /dev/null
214 echo "* Creating $name.7z"
215 7za a -bd $name.7z $name > /dev/null
218 echo "WARNING: ignoring compression '$comp', not known!"
220 esac
221 done
224 # Cleanup
225 rm -f $name.tar
226 # Remove directory with current dist set
227 rm -rf $name
228 done
230 # Cleanup
231 rm -rf phpMyAdmin-${version}
233 # Signing of files with default GPG key
234 echo "* Signing files"
235 for file in *.gz *.zip *.xz *.bz2 *.7z ; do
236 gpg --detach-sign --armor $file
237 md5sum $file > $file.md5
238 sha1sum $file > $file.sha1
239 done
242 echo ""
243 echo ""
244 echo ""
245 echo "Files:"
246 echo "------"
248 ls -la *.gz *.zip *.xz *.bz2 *.7z
250 cd ..
253 if [ $# -gt 0 ] ; then
254 echo
255 echo "Additional tasks:"
256 while [ $# -gt 0 ] ; do
257 param=$1
258 case $1 in
259 --tag)
260 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
261 echo "* Tagging release as $tagname"
262 git tag -a -m "Released $version" $tagname $branch
263 echo " Dont forget to push tags using: git push --tags"
265 --stable)
266 mark_as_release $branch STABLE
267 git checkout master
270 echo "Unknown parameter: $1!"
271 exit 1
272 esac
273 shift
274 done
275 echo
278 cat <<END
281 Todo now:
282 ---------
284 1. If not already done, tag the repository with the new revision number
285 for a plain release or a release candidate:
286 version 2.7.0 gets RELEASE_2_7_0
287 version 2.7.1-rc1 gets RELEASE_2_7_1RC1
289 2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
290 this release and paste into it the ChangeLog for this release, followed
291 by the notes of all previous incremental versions (i.e. 4.4.9 through 4.4.0)
292 3. upload the files to our file server, use scripts/upload-release, eg.:
294 ./scripts/upload-release $version release
295 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/
296 5. send a short mail (with list of major changes) to
297 developers@phpmyadmin.net
298 news@phpmyadmin.net
300 Don't forget to update the Description section in the announcement,
301 based on documentation.
303 6. increment rc count or version in the repository :
304 - in libraries/Config.class.php PMA_Config::__constructor() the line
305 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
306 - in Documentation.html (if it exists) the 2 lines
307 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
308 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
309 - in doc/conf.py (if it exists) the line
310 " version = '2.7.1-dev' "
312 7. add a milestone for this new version in the bugs tickets, at https://sourceforge.net/p/phpmyadmin/bugs/milestones and set it to the default one
314 8. tweet from @phpmya a link to the release notes (see item 5 above); your account should be added to TweetDeck to ease this posting
316 9. for a stable version, update demo/php/versions.ini in the scripts repository so that the demo server shows current versions
318 10. in case of a new major release, update the pmaweb/settings.py in website repository to include the new major releases
320 11. the end :-)