Translated using Weblate (Turkish)
[phpmyadmin.git] / scripts / create-release.sh
blob0a6a93fa18c4ce8ae775bf8651a8f5dafab2c20c
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]"
21 echo ""
22 echo "If --tag is specified, release 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 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 incremented rc count or version in the repository :
58 - in libraries/Config.class.php PMA_Config::__constructor() the line
59 " \$this->set( 'PMA_VERSION', '$version' ); "
60 - in Documentation.html (if exists) the 2 lines
61 " <title>phpMyAdmin $version - Documentation</title> "
62 " <h1>phpMyAdmin $version Documentation</h1> "
63 - in doc/conf.py (if exists) the line
64 " version = '$version' "
65 - in README
67 Continue (y/n)?
68 END
69 read do_release
71 if [ "$do_release" != 'y' ]; then
72 exit 100
75 # Ensure we have tracking branch
76 ensure_local_branch $branch
78 # Create working copy
79 mkdir -p release
80 workdir=release/phpMyAdmin-$version
81 if [ -d $workdir ] ; then
82 echo "Working directory '$workdir' already exists, please move it out of way"
83 exit 1
85 git clone --local . $workdir
86 cd $workdir
88 # Checkout branch
89 ensure_local_branch $branch
90 git checkout $branch
92 # Check release version
93 if ! grep -q "'PMA_VERSION', '$version'" libraries/Config.class.php ; then
94 echo "There seems to be wrong version in libraries/Config.class.php!"
95 exit 2
97 if test -f Documentation.html && ! grep -q "phpMyAdmin $version - Documentation" Documentation.html ; then
98 echo "There seems to be wrong version in Documentation.html"
100 if test -f doc/conf.py && ! grep -q "version = '$version'" doc/conf.py ; then
101 echo "There seems to be wrong version in doc/conf.py"
102 exit 2
104 if ! grep -q "Version $version\$" README ; then
105 echo "There seems to be wrong version in README"
106 exit 2
109 # Cleanup release dir
110 LC_ALL=C date -u > RELEASE-DATE-${version}
112 # Building documentation
113 echo "* Generating documentation"
114 if [ -f doc/conf.py ] ; then
115 LC_ALL=C make -C doc html
116 else
117 LC_ALL=C w3m -dump Documentation.html > Documentation.txt
120 # Check for gettext support
121 if [ -d po ] ; then
122 echo "* Generating mo files"
123 ./scripts/generate-mo
124 if [ -f ./scripts/remove-incomplete-mo ] ; then
125 echo "* Removing incomplete translations"
126 ./scripts/remove-incomplete-mo
128 echo "* Removing gettext source files"
129 rm -rf po
132 if [ -f ./scripts/compress-js ] ; then
133 echo "* Compressing javascript files"
134 ./scripts/compress-js
135 rm -rf sources
138 echo "* Removing unneeded files"
140 # Remove test directory from package to avoid Path disclosure messages
141 # if someone runs /test/wui.php and there are test failures
142 rm -rf test
144 # Remove phpcs coding standard definition
145 rm -rf PMAStandard
147 # Testsuite setup
148 rm -f build.xml phpunit.xml.dist .travis.yml
150 # Remove readme for github
151 rm -f README.rst
153 # Remove git metadata
154 rm -rf .git
155 find . -name .gitignore -print0 | xargs -0 -r rm -f
157 cd ..
159 # Prepare all kits
160 for kit in $KITS ; do
161 # Copy all files
162 name=phpMyAdmin-$version-$kit
163 cp -r phpMyAdmin-$version $name
165 # Cleanup translations
166 cd phpMyAdmin-$version-$kit
167 scripts/lang-cleanup.sh $kit
168 if [ -f examples/create_tables.sql ] ; then
169 # 3.5 and newer
170 rm -rf scripts
171 else
172 # 3.4 and older
173 # Remove javascript compiler, no need to ship it
174 rm -rf scripts/google-javascript-compiler/
176 # Remove scripts which are not useful for user
177 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
178 rm -f scripts/$s
179 done
181 cd ..
183 # Remove tar file possibly left from previous run
184 rm -f $name.tar
186 # Prepare distributions
187 for comp in $COMPRESSIONS ; do
188 case $comp in
189 tbz|tgz|txz)
190 if [ ! -f $name.tar ] ; then
191 echo "* Creating $name.tar"
192 tar cf $name.tar $name
194 if [ $comp = tbz ] ; then
195 echo "* Creating $name.tar.bz2"
196 bzip2 -9k $name.tar
198 if [ $comp = txz ] ; then
199 echo "* Creating $name.tar.xz"
200 xz -9k $name.tar
202 if [ $comp = tgz ] ; then
203 echo "* Creating $name.tar.gz"
204 gzip -9c $name.tar > $name.tar.gz
207 zip)
208 echo "* Creating $name.zip"
209 zip -q -9 -r $name.zip $name
211 zip-7z)
212 echo "* Creating $name.zip"
213 7za a -bd -tzip $name.zip $name > /dev/null
216 echo "* Creating $name.7z"
217 7za a -bd $name.7z $name > /dev/null
220 echo "WARNING: ignoring compression '$comp', not known!"
222 esac
224 # Cleanup
225 rm -f $name.tar
226 done
228 # Remove directory with current dist set
229 rm -rf $name
230 done
232 # Cleanup
233 rm -rf phpMyAdmin-${version}
236 echo ""
237 echo ""
238 echo ""
239 echo "Files:"
240 echo "------"
242 ls -la *.gz *.zip *.bz2 *.7z
244 cd ..
247 if [ $# -gt 0 ] ; then
248 echo
249 echo "Additional tasks:"
250 while [ $# -gt 0 ] ; do
251 param=$1
252 case $1 in
253 --tag)
254 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
255 echo "* Tagging release as $tagname"
256 git tag -a -m "Released $version" $tagname $branch
257 if echo $version | grep -q '^2\.11\.' ; then
258 echo '* 2.11 branch, no STABLE update'
259 elif echo $version | grep -q '^3\.3\.' ; then
260 echo '* 3.3 branch, no STABLE update'
261 elif echo $version | grep -q '^3\.4\.' ; then
262 echo '* 3.4 branch, no STABLE update'
263 elif echo $version | grep '[\-]' ; then
264 echo '* no STABLE update'
265 else
266 mark_as_release $branch STABLE
267 git checkout master
269 echo " Dont forget to push tags using: git push --tags"
272 echo "Unknown parameter: $1!"
273 exit 1
274 esac
275 shift
276 done
277 echo
280 cat <<END
283 Todo now:
284 ---------
286 1. If not already done, tag the repository with the new revision number
287 for a plain release or a release candidate:
288 version 2.7.0 gets two tags: RELEASE_2_7_0 and STABLE
289 version 2.7.1-rc1 gets RELEASE_2_7_1RC1
291 2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
292 this release and paste into it the ChangeLog for this release
293 3. upload the files to SF, you can use scripts/upload-release, eg.:
295 ./scripts/upload-release \$USER $version release
296 4. add SF news item to phpMyAdmin project
297 5. announce release on freecode (http://freecode.com/projects/phpmyadmin/)
298 6. send a short mail (with list of major changes) to
299 phpmyadmin-devel@lists.sourceforge.net
300 phpmyadmin-news@lists.sourceforge.net
301 phpmyadmin-users@lists.sourceforge.net
303 Don't forget to update the Description section in the announcement,
304 based on documentation.
306 7. increment rc count or version in the repository :
307 - in libraries/Config.class.php PMA_Config::__constructor() the line
308 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
309 - in Documentation.html (if it exists) the 2 lines
310 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
311 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
312 - in doc/conf.py (if it exists) the line
313 " version = '2.7.1-dev' "
315 8. add a milestone for this new version in the bugs tickets, at https://sourceforge.net/p/phpmyadmin/bugs/milestones
317 9. the end :-)