Translated using Weblate (French)
[phpmyadmin.git] / scripts / create-release.sh
blobdcba2c5019282062e76f1fc3ff19649d78e8cd58
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"
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
222 # Cleanup
223 rm -f $name.tar
224 done
226 # Remove directory with current dist set
227 rm -rf $name
228 done
230 # Cleanup
231 rm -rf phpMyAdmin-${version}
234 echo ""
235 echo ""
236 echo ""
237 echo "Files:"
238 echo "------"
240 ls -la *.gz *.zip *.bz2 *.7z
242 cd ..
245 if [ $# -gt 0 ] ; then
246 echo
247 echo "Additional tasks:"
248 while [ $# -gt 0 ] ; do
249 param=$1
250 case $1 in
251 --tag)
252 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
253 echo "* Tagging release as $tagname"
254 git tag -a -m "Released $version" $tagname $branch
255 echo " Dont forget to push tags using: git push --tags"
257 --stable)
258 mark_as_release $branch STABLE
259 git checkout master
262 echo "Unknown parameter: $1!"
263 exit 1
264 esac
265 shift
266 done
267 echo
270 cat <<END
273 Todo now:
274 ---------
276 1. If not already done, tag the repository with the new revision number
277 for a plain release or a release candidate:
278 version 2.7.0 gets RELEASE_2_7_0
279 version 2.7.1-rc1 gets RELEASE_2_7_1RC1
281 2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
282 this release and paste into it the ChangeLog for this release
283 3. upload the files to SF, you can use scripts/upload-release, eg.:
285 ./scripts/upload-release \$USER $version release
286 4. if this is the latest stable version, visit https://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin, pick the newly created version, expand the directory and use the I icons to mark that
287 - the -all-languages.zip file is the default for Windows and Others
288 - the -all-languages.tar.gz file is the default for Solaris
289 - the -all-languages.tar.bz2 file is the default for Mac OS X, Linux and BSD
290 5. add a SF news item to phpMyAdmin project; a good idea is to include a link to the release notes such as https://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.3.7/phpMyAdmin-4.3.7-notes.html/view because this news item gets relayed via RSS to our Facebook page
291 6. send a short mail (with list of major changes) to
292 phpmyadmin-devel@lists.sourceforge.net
293 phpmyadmin-news@lists.sourceforge.net
295 Don't forget to update the Description section in the announcement,
296 based on documentation.
298 7. increment rc count or version in the repository :
299 - in libraries/Config.class.php PMA_Config::__constructor() the line
300 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
301 - in Documentation.html (if it exists) the 2 lines
302 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
303 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
304 - in doc/conf.py (if it exists) the line
305 " version = '2.7.1-dev' "
307 8. add a milestone for this new version in the bugs tickets, at https://sourceforge.net/p/phpmyadmin/bugs/milestones
309 9. tweet from @phpmya a link to the release notes (see item 5 above); your account should be added to TweetDeck to ease this posting
311 10. for a stable version, update demo/php/versions.ini in the scripts repository so that the demo server shows current versions
313 11. in case of a new major release, update the render.py in website repository to include the new major releases
315 12. the end :-)