3 # vim: expandtab sw=4 ts=4 sts=4:
7 if [ -n "$GATEWAY_INTERFACE" ] ; then
8 echo 'Can not invoke as CGI!'
12 # More documentation about making a release is available at:
13 # https://wiki.phpmyadmin.net/pma/Releasing
15 # Fail on undefined variables
20 KITS
="all-languages english source"
21 COMPRESSIONS
="zip-7z txz tgz"
35 while [ $# -gt 0 ] ; do
55 if [ -z "$branch" ] ; then
63 echo " create-release.sh <version> <from_branch> [--tag] [--stable] [--test] [--ci]"
65 echo "If --tag is specified, release tag is automatically created (use this for all releases including pre-releases)"
66 echo "If --stable is specified, the STABLE branch is updated with this release"
67 echo "If --test is specified, the testsuite is executed before creating the release"
68 echo "If --ci is specified, the testsuite is executed and no actual release is created"
71 echo " create-release.sh 2.9.0-rc1 QA_2_9"
72 echo " create-release.sh 2.9.0 MAINT_2_9_0 --tag --stable"
76 if [ -z "$version" ] ; then
77 version
=`echo $1 | tr -d -c '0-9a-z.+-'`
78 if [ "x$version" != "x$1" ] ; then
79 echo "Invalid version: $1"
82 elif [ -z "$branch" ] ; then
83 branch
=`echo $1 | tr -d -c '0-9A-Za-z_-'`
84 if [ "x$branch" != "x$1" ] ; then
85 echo "Invalid branch: $1"
89 echo "Unknown parameter: $1!"
96 if [ -z "$version" -o -z "$branch" ] ; then
97 echo "Branch and version have to be specified!"
101 # Checks whether remote branch has local tracking branch
102 ensure_local_branch
() {
103 if ! git branch |
grep -q '^..'"$1"'$' ; then
104 git branch
--track $1 origin
/$1
108 # Marks current head of given branch as head of other branch
109 # Used for STABLE tracking
113 echo "* Marking release as $rel_branch"
114 ensure_local_branch
$rel_branch
115 git checkout
$rel_branch
116 git merge
-s recursive
-X theirs
$branch
120 # Ensure we have tracking branch
121 ensure_local_branch
$branch
123 # Check if we're releasing older
124 if git cat-file
-e $branch:libraries
/classes
/Config.php
2> /dev
/null
; then
125 CONFIG_LIB
=libraries
/classes
/Config.php
126 elif git cat-file
-e $branch:libraries
/Config.php
2> /dev
/null
; then
127 CONFIG_LIB
=libraries
/Config.php
129 CONFIG_LIB
=libraries
/Config.class.php
132 if [ $do_ci -eq 0 -a -$do_daily -eq 0 ] ; then
135 Please ensure you have incremented rc count or version in the repository :
136 - in $CONFIG_LIB Config::__constructor() the line
137 " \$this->set( 'PMA_VERSION', '$version' ); "
138 - in doc/conf.py the line
139 " version = '$version' "
141 - set release date in ChangeLog
147 if [ "$do_release" != 'y' ]; then
152 # Create working copy
155 workdir
=release
/phpMyAdmin-
$version
156 if [ -d $workdir ] ; then
157 echo "Working directory '$workdir' already exists, please move it out of way"
161 # Add worktree with chosen branch
162 git worktree add
--force $workdir $branch
164 if [ $do_pull -eq 1 ] ; then
167 if [ $do_daily -eq 1 ] ; then
168 git_head
=`git log -n 1 --format=%H`
171 # Check release version
172 if [ $do_ci -eq 0 -a -$do_daily -eq 0 ] ; then
173 if ! grep -q "'PMA_VERSION', '$version'" $CONFIG_LIB ; then
174 echo "There seems to be wrong version in $CONFIG_LIB!"
177 if ! grep -q "version = '$version'" doc
/conf.py
; then
178 echo "There seems to be wrong version in doc/conf.py"
181 if ! grep -q "Version $version\$" README
; then
182 echo "There seems to be wrong version in README"
187 # Cleanup release dir
188 LC_ALL
=C
date -u > RELEASE-DATE-
${version}
190 # Building documentation
191 echo "* Generating documentation"
192 LC_ALL
=C
make -C doc html
193 find doc
-name '*.pyc' -print0 |
xargs -0 -r rm -f
195 # Check for gettext support
197 echo "* Generating mo files"
198 .
/scripts
/generate-mo
199 if [ -f .
/scripts
/remove-incomplete-mo
] ; then
200 echo "* Removing incomplete translations"
201 .
/scripts
/remove-incomplete-mo
205 if [ -f .
/scripts
/line-counts.sh
] ; then
206 echo "* Generating line counts"
207 .
/scripts
/line-counts.sh
210 echo "* Removing unneeded files"
212 # Remove developer information
215 # Remove phpcs coding standard definition
219 rm -f .travis.yml .coveralls.yml .scrutinizer.yml .jshintrc .weblate codecov.yml
221 # Remove readme for github
224 if [ ! -d libraries
/tcpdf
] ; then
225 if [ "$branch" = "QA_4_8" ] ; then
226 PHP_REQ
=`sed -n '/"php"/ s/.*">=\([0-9]\.[0-9]\).*/\1/p' composer.json`
228 PHP_REQ
=`sed -n '/"php"/ s/.*"\^\([0-9]\.[0-9]\.[0-9]\).*/\1/p' composer.json`
231 if [ -z "$PHP_REQ" ] ; then
232 echo "Failed to figure out required PHP version from composer.json"
235 # Okay, there is no way to tell composer to install
236 # suggested package. Let's require it and then revert
237 # composer.json to original state.
238 cp composer.json composer.json.backup
239 echo "* Running composer"
240 composer config platform.php
"$PHP_REQ"
241 composer update
--no-dev
243 # Parse the required versions from composer.json
245 if [ "$branch" = "QA_4_8" ] ; then
246 PACKAGE_LIST
="tecnickcom/tcpdf pragmarx/google2fa bacon/bacon-qr-code samyoul/u2f-php-server"
248 PACKAGE_LIST
="tecnickcom/tcpdf pragmarx/google2fa-qrcode samyoul/u2f-php-server"
250 for PACKAGES
in $PACKAGE_LIST
252 PACKAGES_VERSIONS
="$PACKAGES_VERSIONS $PACKAGES:`awk "/require-dev
/ {printline
= 1; print
; next
} printline
" composer.json | grep "$PACKAGES" | awk -F [\\"] '{print $4}'`"
254 composer require --update-no-dev $PACKAGES_VERSIONS
256 mv composer.json.backup composer.json
257 echo "* Cleanup of composer packages"
259 vendor/phpmyadmin/sql-parser/tests/ \
260 vendor/phpmyadmin/sql-parser/tools/ \
261 vendor/phpmyadmin/sql-parser/locale/*/LC_MESSAGES/sqlparser.po \
262 vendor/phpmyadmin/motranslator/tests/ \
263 vendor/phpmyadmin/shapefile/tests/ \
264 vendor/phpmyadmin/shapefile/examples/ \
265 vendor/phpmyadmin/shapefile/data/ \
266 vendor/phpseclib/phpseclib/phpseclib/File/ \
267 vendor/phpseclib/phpseclib/phpseclib/Math/ \
268 vendor/phpseclib/phpseclib/phpseclib/Net/ \
269 vendor/phpseclib/phpseclib/phpseclib/System/ \
270 vendor/symfony/cache/Tests/ \
271 vendor/symfony/expression-language/Tests/ \
272 vendor/symfony/expression-language/Resources/ \
273 vendor/tecnickcom/tcpdf/examples/ \
274 vendor/tecnickcom/tcpdf/tools/ \
275 vendor/tecnickcom/tcpdf/fonts/ae_fonts_*/ \
276 vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.33/ \
277 vendor/tecnickcom/tcpdf/fonts/freefont-*/ \
278 vendor/tecnickcom/tcpdf/include/sRGB.icc \
279 vendor/twig/extensions/doc \
280 vendor/twig/extensions/test \
281 vendor/twig/twig/doc \
282 vendor/twig/twig/test \
283 vendor/google/recaptcha/examples/ \
284 vendor/google/recaptcha/tests/
285 find vendor/phpseclib/phpseclib/phpseclib/Crypt/ -maxdepth 1 -type f -not -name AES.php -not -name Base.php -not -name Random.php -not -name Rijndael.php -print0 | xargs -0 rm
286 find vendor/tecnickcom/tcpdf/fonts/ -maxdepth 1 -type f -not -name 'dejavusans.*' -not -name 'dejavusansb.*' -not -name 'helvetica.php' -print0 | xargs -0 rm
287 if [ $do_tag -eq 1 ] ; then
288 echo "* Commiting composer.lock"
289 git add --force composer.lock
290 git commit -s -m "Adding composer lock for $version"
294 if [ -f package.json ] ; then
295 echo "* Running Yarn"
296 yarn install --production
299 # Remove git metadata
301 find . -name .gitignore -print0 | xargs -0 -r rm -f
302 find . -name .gitattributes -print0 | xargs -0 -r rm -f
304 if [ $do_test -eq 1 ] ; then
306 ./vendor/bin/phpunit --configuration phpunit.xml.nocoverage --exclude-group selenium
308 if [ $do_ci -eq 1 ] ; then
312 if [ "$branch" = "ci" ] ; then
317 if [ $test_ret -ne 0 ] ; then
320 # Remove libs installed for testing
322 composer update --no-dev
329 for kit in $KITS ; do
331 name=phpMyAdmin-$version-$kit
332 cp -r phpMyAdmin-$version $name
334 # Cleanup translations
335 cd phpMyAdmin-$version-$kit
336 ./scripts/lang-cleanup.sh $kit
338 # Remove tests, source code,...
339 if [ $kit != source ] ; then
340 echo "* Removing source files"
343 rm phpunit.xml.* build.xml
346 # Documentation source code
351 rm doc/html/.buildinfo doc/html/objects.inv
353 rm -rf js/vendor/openlayers/src/
357 # Remove developer scripts
362 # Remove tar file possibly left from previous run
365 # Prepare distributions
366 for comp in $COMPRESSIONS ; do
369 if [ ! -f $name.tar ] ; then
370 echo "* Creating $name.tar"
371 tar --owner=root --group=root --numeric-owner --sort=name -cf $name.tar $name
373 if [ $comp = txz ] ; then
374 echo "* Creating $name.tar.xz"
377 if [ $comp = tgz ] ; then
378 echo "* Creating $name.tar.gz"
379 gzip -9c $name.tar > $name.tar.gz
383 echo "* Creating $name.zip"
384 7za a -bd -tzip $name.zip $name > /dev/null
387 echo "WARNING: ignoring compression '$comp', not known!"
395 # Remove directory with current dist set
400 rm -rf phpMyAdmin-${version}
403 # Signing of files with default GPG key
404 echo "* Signing files"
405 for file in phpMyAdmin-$version-*.gz phpMyAdmin-$version-*.zip phpMyAdmin-$version-*.xz ; do
406 if [ $do_sign -eq 1 ] ; then
407 gpg --detach-sign --armor $file
409 sha1sum $file > $file.sha1
410 sha256sum $file > $file.sha256
413 if [ $do_daily -eq 1 ] ; then
414 cat > phpMyAdmin-${version}.json << EOT
416 "date": "`date --iso-8601=seconds
`",
417 "commit": "$git_head"
430 ls -la *.gz *.zip *.xz
435 if [ $do_tag -eq 1 ] ; then
437 echo "Additional tasks:"
438 tagname=RELEASE_`echo $version |
tr . _ |
tr '[:lower:]' '[:upper:]' |
tr -d -`
439 echo "* Tagging release as $tagname"
440 git tag -s -a -m "Released $version" $tagname $branch
441 echo " Dont forget to push tags using: git push --tags"
442 echo "* Cleanup of $branch"
443 # Remove composer.lock, but we need to create fresh worktree for that
444 git worktree add --force $workdir $branch
446 git rm --force composer.lock
447 git commit -s -m "Removing composer.lock"
453 # Mark as stable release
454 if [ $do_stable -eq 1 ] ; then
455 mark_as_release $branch STABLE
464 1. Push the new tag upstream, with a command like git push origin --tags
466 2. Push the new STABLE branch upstream
468 3. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
469 this release and paste into it the ChangeLog for this release, followed
470 by the notes of all previous incremental versions (i.e. 4.4.9 through 4.4.0)
472 4. upload the files to our file server, use scripts/upload-release, eg.:
474 ./scripts/upload-release $version release
476 5. 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/
478 6. send a short mail (with list of major changes) to
479 developers@phpmyadmin.net
482 Don't forget to update the Description section in the announcement,
483 based on documentation.
485 7. increment rc count or version in the repository :
486 - in $CONFIG_LIB Config::__constructor() the line
487 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
488 - in Documentation.html (if it exists) the 2 lines
489 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
490 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
491 - in doc/conf.py (if it exists) the line
492 " version = '2.7.1-dev' "
494 8. 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
496 9. for a major release, update demo/php/versions.ini in the scripts repository so that the demo server shows current versions
498 10. in case of a new major release ('y' in x.y.0), update the pmaweb/settings.py in website repository to include the new major releases
500 11. update the Dockerfile in the docker repository to reflect the new version and create a new annotated tag (such as with git tag -s -a 4.7.9-1 -m "Version 4.7.9-1"). Remember to push the tag with git push origin --tags