Translated using Weblate (Portuguese (Brazil))
[phpmyadmin.git] / scripts / create-release.sh
blobca4e0d1fd05dafeb145b5050be27fea624d6d03a
1 #!/bin/sh
3 # vim: expandtab sw=4 ts=4 sts=4:
6 # Do not run as CGI
7 if [ -n "$GATEWAY_INTERFACE" ] ; then
8 echo 'Can not invoke as CGI!'
9 exit 1
12 # More documentation about making a release is available at:
13 # https://wiki.phpmyadmin.net/pma/Releasing
15 # Fail on undefined variables
16 set -u
17 # Fail on failure
18 set -e
20 KITS="all-languages english source"
21 COMPRESSIONS="zip-7z txz tgz"
22 # The version series this script is allowed to handle
23 VERSION_SERIES="5.2"
25 # Process parameters
27 version=""
28 branch=""
29 do_tag=0
30 do_stable=0
31 do_test=0
32 do_ci=0
33 do_sign=1
34 do_pull=0
35 do_daily=0
37 while [ $# -gt 0 ] ; do
38 case "$1" in
39 --tag)
40 do_tag=1
42 --stable)
43 do_stable=1
45 --test)
46 do_test=1
48 --daily)
49 do_sign=0
50 do_pull=1
51 do_daily=1
52 do_test=1
54 --ci)
55 do_test=1
56 do_ci=1
57 if [ -z "$branch" ] ; then
58 git branch ci
59 branch="ci"
62 --help)
63 echo "Usages:"
64 echo " create-release.sh <version> <from_branch> [--tag] [--stable] [--test] [--ci]"
65 echo ""
66 echo "If --tag is specified, release tag is automatically created (use this for all releases including pre-releases)"
67 echo "If --stable is specified, the STABLE branch is updated with this release"
68 echo "If --test is specified, the testsuite is executed before creating the release"
69 echo "If --ci is specified, the testsuite is executed and no actual release is created"
70 echo ""
71 echo "Examples:"
72 echo " create-release.sh 2.9.0-rc1 QA_2_9"
73 echo " create-release.sh 2.9.0 MAINT_2_9_0 --tag --stable"
74 exit 65
77 do_test=1
78 if [ -z "$version" ] ; then
79 version=`echo $1 | tr -d -c '0-9a-z.+-'`
80 if [ "x$version" != "x$1" ] ; then
81 echo "Invalid version: $1"
82 exit 1
84 elif [ -z "$branch" ] ; then
85 branch=`echo $1 | tr -d -c '/0-9A-Za-z_-'`
86 if [ "x$branch" != "x$1" ] ; then
87 echo "Invalid branch: $1"
88 exit 1
90 else
91 echo "Unknown parameter: $1!"
92 exit 1
94 esac
95 shift
96 done
98 if [ -z "$branch" ]; then
99 echo "Branch must be specified!"
100 exit 1
103 if [ -z "$version" -a $do_ci -eq 0 ]; then
104 echo "Version must be specified!"
105 exit 1
108 kit_prefix="phpMyAdmin-$version"
110 # Checks whether remote branch has local tracking branch
111 ensure_local_branch() {
112 if ! git branch | grep -q '^..'"$1"'$' ; then
113 git branch --track $1 origin/$1
117 # Marks current head of given branch as head of other branch
118 # Used for STABLE tracking
119 mark_as_release() {
120 branch=$1
121 rel_branch=$2
122 echo "* Marking release as $rel_branch"
123 ensure_local_branch $rel_branch
124 git checkout $rel_branch
125 git merge -s recursive -X theirs $branch
126 git checkout master
129 cleanup_composer_vendors() {
130 echo "* Cleanup of composer packages"
131 rm -rf \
132 vendor/phpmyadmin/sql-parser/tests/ \
133 vendor/phpmyadmin/sql-parser/tools/ \
134 vendor/phpmyadmin/sql-parser/src/Tools/ \
135 vendor/phpmyadmin/sql-parser/locale/sqlparser.pot \
136 vendor/phpmyadmin/sql-parser/locale/*/LC_MESSAGES/sqlparser.po \
137 vendor/phpmyadmin/sql-parser/bin/ \
138 vendor/phpmyadmin/sql-parser/phpunit.xml.dist \
139 vendor/phpmyadmin/motranslator/phpunit.xml.dist \
140 vendor/phpmyadmin/motranslator/tests/ \
141 vendor/phpmyadmin/shapefile/codecov.yml \
142 vendor/phpmyadmin/shapefile/phpunit.xml.dist \
143 vendor/phpmyadmin/shapefile/tests/ \
144 vendor/phpmyadmin/shapefile/examples/ \
145 vendor/phpmyadmin/shapefile/data/ \
146 vendor/phpmyadmin/shapefile/phpstan-baseline.neon \
147 vendor/phpmyadmin/shapefile/phpstan.neon.dist \
148 vendor/phpmyadmin/twig-i18n-extension/README.rst \
149 vendor/phpmyadmin/twig-i18n-extension/phpunit.xml.dist \
150 vendor/phpmyadmin/twig-i18n-extension/test/ \
151 vendor/phpseclib/phpseclib/phpseclib/File/ \
152 vendor/phpseclib/phpseclib/phpseclib/Math/ \
153 vendor/phpseclib/phpseclib/phpseclib/Net/ \
154 vendor/phpseclib/phpseclib/phpseclib/System/ \
155 vendor/phpseclib/phpseclib/appveyor.yml \
156 vendor/phpseclib/phpseclib/.github \
157 vendor/symfony/cache/Tests/ \
158 vendor/symfony/service-contracts/Test/ \
159 vendor/symfony/expression-language/Tests/ \
160 vendor/symfony/expression-language/Resources/ \
161 vendor/symfony/dependency-injection/Loader/schema/dic/services/services-1.0.xsd \
162 vendor/tecnickcom/tcpdf/examples/ \
163 vendor/tecnickcom/tcpdf/tools/ \
164 vendor/tecnickcom/tcpdf/fonts/ae_fonts_*/ \
165 vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.*/ \
166 vendor/tecnickcom/tcpdf/fonts/freefont-*/ \
167 vendor/tecnickcom/tcpdf/include/sRGB.icc \
168 vendor/tecnickcom/tcpdf/.git \
169 vendor/tecnickcom/tcpdf/.github/ \
170 vendor/bacon/bacon-qr-code/phpunit.xml.dist \
171 vendor/bacon/bacon-qr-code/test/ \
172 vendor/dasprid/enum/.github/ \
173 vendor/dasprid/enum/phpunit.xml.dist \
174 vendor/dasprid/enum/test/ \
175 vendor/williamdes/mariadb-mysql-kbs/phpunit.xml \
176 vendor/williamdes/mariadb-mysql-kbs/test/ \
177 vendor/williamdes/mariadb-mysql-kbs/schemas/ \
178 vendor/williamdes/mariadb-mysql-kbs/dist/merged-raw.json \
179 vendor/williamdes/mariadb-mysql-kbs/dist/merged-raw.md \
180 vendor/williamdes/mariadb-mysql-kbs/dist/merged-slim.json \
181 vendor/williamdes/mariadb-mysql-kbs/dist/merged-ultraslim.php \
182 vendor/code-lts/u2f-php-server/phpunit.xml \
183 vendor/code-lts/u2f-php-server/test/ \
184 vendor/nikic/fast-route/.travis.yml \
185 vendor/nikic/fast-route/.hhconfig \
186 vendor/nikic/fast-route/FastRoute.hhi \
187 vendor/nikic/fast-route/phpunit.xml \
188 vendor/nikic/fast-route/psalm.xml \
189 vendor/nikic/fast-route/test/ \
190 vendor/twig/twig/doc/ \
191 vendor/twig/twig/test/ \
192 vendor/twig/twig/.github/ \
193 vendor/twig/twig/README.rst \
194 vendor/twig/twig/.travis.yml \
195 vendor/twig/twig/.editorconfig \
196 vendor/twig/twig/.php_cs.dist \
197 vendor/twig/twig/drupal_test.sh \
198 vendor/twig/twig/.php-cs-fixer.dist.php \
199 vendor/webmozart/assert/.editorconfig \
200 vendor/webmozart/assert/.github/ \
201 vendor/webmozart/assert/.php_cs \
202 vendor/webmozart/assert/psalm.xml \
203 vendor/twig/twig/src/Test/ \
204 vendor/psr/http-message/docs/ \
205 vendor/psr/log/Psr/Log/Test/ \
206 vendor/psr/http-factory/.pullapprove.yml \
207 vendor/slim/psr7/MAINTAINERS.md \
208 vendor/paragonie/constant_time_encoding/tests/ \
209 vendor/paragonie/constant_time_encoding/psalm.xml \
210 vendor/paragonie/constant_time_encoding/phpunit.xml.dist \
211 vendor/paragonie/constant_time_encoding/.travis.yml \
212 vendor/paragonie/random_compat/other/build_phar.php \
213 vendor/paragonie/random_compat/other \
214 vendor/paragonie/random_compat/build-phar.sh \
215 vendor/paragonie/random_compat/dist/random_compat.phar.pubkey \
216 vendor/paragonie/random_compat/dist/random_compat.phar.pubkey.asc \
217 vendor/paragonie/random_compat/dist \
218 vendor/paragonie/random_compat/psalm-autoload.php \
219 vendor/paragonie/random_compat/psalm.xml \
220 vendor/paragonie/sodium_compat/.github/ \
221 vendor/paragonie/sodium_compat/dist/ \
222 vendor/paragonie/sodium_compat/phpunit.xml.dist \
223 vendor/paragonie/sodium_compat/.gitignore \
224 vendor/paragonie/sodium_compat/psalm-above-3.xml \
225 vendor/paragonie/sodium_compat/psalm-below-3.xml \
226 vendor/paragonie/sodium_compat/build-phar.sh \
227 vendor/paragonie/sodium_compat/appveyor.yml \
228 vendor/paragonie/sodium_compat/autoload-phpunit.php \
229 vendor/paragonie/sodium_compat/autoload-pedantic.php \
230 vendor/paragonie/sodium_compat/autoload-fast.php \
231 vendor/paragonie/sodium_compat/composer-php52.json \
232 vendor/paragonie/sodium_compat/src/PHP52/SplFixedArray.php \
233 vendor/paragonie/sodium_compat/src/PHP52 \
234 vendor/pragmarx/google2fa/phpstan.neon \
235 vendor/pragmarx/google2fa-qrcode/.scrutinizer.yml \
236 vendor/pragmarx/google2fa-qrcode/.travis.yml \
237 vendor/pragmarx/google2fa-qrcode/phpunit.xml \
238 vendor/pragmarx/google2fa-qrcode/tests \
239 vendor/google/recaptcha/src/autoload.php \
240 vendor/google/recaptcha/app.yaml \
241 vendor/google/recaptcha/.travis.yml \
242 vendor/google/recaptcha/phpunit.xml.dist \
243 vendor/google/recaptcha/.github/ \
244 vendor/google/recaptcha/examples/ \
245 vendor/google/recaptcha/tests/
246 rm -rf \
247 vendor/google/recaptcha/ARCHITECTURE.md \
248 vendor/google/recaptcha/CONTRIBUTING.md \
249 vendor/phpmyadmin/motranslator/CODE_OF_CONDUCT.md \
250 vendor/phpmyadmin/motranslator/CONTRIBUTING.md \
251 vendor/phpmyadmin/motranslator/PERFORMANCE.md \
252 vendor/phpmyadmin/shapefile/CONTRIBUTING.md \
253 vendor/phpmyadmin/shapefile/CODE_OF_CONDUCT.md \
254 vendor/phpmyadmin/sql-parser/CODE_OF_CONDUCT.md \
255 vendor/phpmyadmin/sql-parser/CONTRIBUTING.md \
256 vendor/beberlei/assert/.github/ \
257 vendor/brick/math/SECURITY.md \
258 vendor/brick/math/psalm-baseline.xml \
259 vendor/brick/math/psalm.xml \
260 vendor/ramsey/collection/SECURITY.md \
261 vendor/spomky-labs/base64url/.github/ \
262 vendor/spomky-labs/cbor-php/.php_cs.dist \
263 vendor/spomky-labs/cbor-php/CODE_OF_CONDUCT.md \
264 vendor/spomky-labs/cbor-php/infection.json.dist \
265 vendor/spomky-labs/cbor-php/phpstan.neon \
266 vendor/thecodingmachine/safe/generated/Exceptions/.gitkeep \
267 vendor/thecodingmachine/safe/rector-migrate-0.7.php
268 find vendor/tecnickcom/tcpdf/fonts/ -maxdepth 1 -type f \
269 -not -name 'dejavusans.*' \
270 -not -name 'dejavusansb.*' \
271 -not -name 'helvetica.php' \
272 -print0 | xargs -0 rm
275 backup_vendor_folder() {
276 TEMP_FOLDER="$(mktemp -d /tmp/phpMyAdmin.XXXXXXXXX)"
277 cp -rp ./vendor "${TEMP_FOLDER}"
280 restore_vendor_folder() {
281 if [ ! -d ${TEMP_FOLDER} ]; then
282 echo 'No backup to restore'
283 exit 1;
285 rm -r ./vendor
286 mv "${TEMP_FOLDER}/vendor" ./vendor
287 rmdir "${TEMP_FOLDER}"
290 get_composer_package_version() {
291 awk '/require-dev/ {printline = 1; print; next } printline' composer.json | grep "$1" | awk -F [\"] '{print $4}'
294 create_phpunit_sandbox() {
295 PHPUNIT_VERSION="$(get_composer_package_version 'phpunit/phpunit')"
296 TEMP_PHPUNIT_FOLDER="$(mktemp -d /tmp/phpMyAdmin-phpunit.XXXXXXXXX)"
297 cd "${TEMP_PHPUNIT_FOLDER}"
298 composer require --no-interaction --dev "phpunit/phpunit:${PHPUNIT_VERSION}"
299 cd -
302 delete_phpunit_sandbox() {
303 if [ ! -d ${TEMP_PHPUNIT_FOLDER} ]; then
304 echo 'No phpunit sandbox to delete'
305 exit 1;
307 rm -r "${TEMP_PHPUNIT_FOLDER}"
310 security_checkup() {
311 if [ ! -f vendor/tecnickcom/tcpdf/tcpdf.php ]; then
312 echo 'TCPDF should be installed, detection failed !'
313 exit 1;
315 if [ ! -f vendor/web-auth/webauthn-lib/src/Server.php ]; then
316 echo 'Webauthn-lib should be installed, detection failed !'
317 exit 1;
319 if [ ! -f vendor/code-lts/u2f-php-server/src/U2FServer.php ]; then
320 echo 'U2F-server should be installed, detection failed !'
321 exit 1;
323 if [ ! -f vendor/pragmarx/google2fa-qrcode/src/Google2FA.php ]; then
324 echo 'Google 2FA should be installed, detection failed !'
325 exit 1;
329 autoload_checkup() {
330 php <<'CODE'
331 <?php
333 $classMapFiles = require __DIR__ . '/vendor/composer/autoload_classmap.php';
335 $foundFiles = 0;
336 $notFoundFiles = 0;
338 foreach ($classMapFiles as $classMapFile) {
339 if (! file_exists($classMapFile)) {
340 echo 'Does not exist: ' . $classMapFile . PHP_EOL;
341 $notFoundFiles++;
342 continue;
344 $foundFiles++;
347 echo '[autoload class map checkup] Found files: ' . $foundFiles . PHP_EOL;
348 echo '[autoload class map checkup] NOT found files: ' . $notFoundFiles . PHP_EOL;
349 $minFilesToHave = 1100;// An arbitrary value based on how many files the autoload has on average
351 if ($foundFiles < $minFilesToHave) {
352 echo '[autoload class map checkup] The project expects at least ' . $minFilesToHave . ' in the autoload class map' . PHP_EOL;
353 exit(1);
356 if ($notFoundFiles > 0) {
357 echo '[autoload class map checkup] There is some missing files documented in the class map' . PHP_EOL;
358 exit(1);
360 echo '[autoload class map checkup] The autoload class map seems okay' . PHP_EOL;
361 CODE
365 # Ensure we have tracking branch
366 ensure_local_branch $branch
368 VERSION_FILE=libraries/classes/Version.php
370 # Keep in sync with update-po script
371 fetchReleaseFromFile() {
372 SUFFIX="${1:-}"
373 php -r "define('VERSION_SUFFIX', '$SUFFIX'); require_once('$VERSION_FILE'); echo \PhpMyAdmin\Version::VERSION;"
376 fetchVersionSeriesFromFile() {
377 php -r "define('VERSION_SUFFIX', ''); require_once('$VERSION_FILE'); echo \PhpMyAdmin\Version::SERIES;"
380 VERSION_FROM_FILE="$(fetchReleaseFromFile)"
381 VERSION_SERIES_FROM_FILE="$(fetchVersionSeriesFromFile)"
383 if [ $do_ci -eq 1 ]; then
384 VERSION_FROM_FILE="$(fetchReleaseFromFile '+ci')"
385 version="${VERSION_FROM_FILE}"
388 if [ "${VERSION_SERIES_FROM_FILE}" != "${VERSION_SERIES}" ]; then
389 echo "This script can not handle ${VERSION_SERIES_FROM_FILE} version series."
390 echo "Only ${VERSION_SERIES} version series are allowed, please use your target branch directly or another branch."
391 echo "By changing branches you will have a release script that was designed for your version series."
392 exit 1;
395 echo "The actual configured release is: $VERSION_FROM_FILE"
396 echo "The actual configured release series is: $VERSION_SERIES_FROM_FILE"
398 if [ $do_ci -eq 0 -a $do_daily -eq 0 ] ; then
399 cat <<END
401 Please ensure you have incremented rc count or version in the repository :
402 - run ./scripts/console set-version $version
403 - in $VERSION_FILE Version class:
404 - check that VERSION, MAJOR, MINOR and PATCH are correct.
405 - in doc/conf.py the line
406 " version = '$version' "
407 - in README the "Version" line
408 - in package.json the line
409 " "version": "$version", "
410 - set release date in ChangeLog
412 Continue (y/n)?
414 read do_release
416 if [ "$do_release" != 'y' ]; then
417 exit 100
419 echo "The actual configured release is now: $(fetchReleaseFromFile)"
422 # Create working copy
423 mkdir -p release
424 git worktree prune
425 workdir_name=phpMyAdmin-$version
426 workdir=release/$workdir_name
427 if [ -d $workdir ] ; then
428 echo "Working directory '$workdir' already exists, please move it out of the way"
429 exit 1
432 # Add worktree with chosen branch
433 git worktree add --force $workdir $branch
434 cd $workdir
435 if [ $do_pull -eq 1 ] ; then
436 git pull -q
438 if [ $do_daily -eq 1 ] ; then
439 git_head=`git log -n 1 --format=%H`
440 git_head_short=`git log -n 1 --format=%h`
441 today_date=`date +'%Y%m%d' -u`
444 if [ $do_daily -eq 1 ] ; then
445 echo '* setting the version suffix for the snapshot'
446 sed -i "s/'versionSuffix' => '.*'/'versionSuffix' => '+$today_date.$git_head_short'/" libraries/vendor_config.php
447 php -l libraries/vendor_config.php
449 # Fetch it back and refresh $version
450 VERSION_FROM_FILE="$(fetchReleaseFromFile "+$today_date.$git_head_short")"
451 version="${VERSION_FROM_FILE}"
452 echo "The actual configured release is: $VERSION_FROM_FILE"
455 # Check release version
456 if [ $do_ci -eq 0 -a -$do_daily -eq 0 ] ; then
457 if ! grep -q "VERSION = '$version'" $VERSION_FILE ; then
458 echo "There seems to be wrong version in $VERSION_FILE!"
459 exit 2
461 if ! grep -q "version = '$version'" doc/conf.py ; then
462 echo "There seems to be wrong version in doc/conf.py"
463 exit 2
465 if ! grep -q "Version $version\$" README ; then
466 echo "There seems to be wrong version in README"
467 exit 2
469 if ! grep -q "\"version\": \"$version\"," package.json ; then
470 echo "There seems to be wrong version in package.json"
471 exit 2
475 # Save the build date
476 if [ $do_daily -eq 1 ] ; then
477 LC_ALL=C date -u > RELEASE-DATE-$VERSION_SERIES_FROM_FILE+snapshot
478 else
479 LC_ALL=C date -u > RELEASE-DATE-$version
482 # Building documentation
483 echo "* Running sphinx-build (version: $(sphinx-build --version))"
484 echo "* Generating documentation"
485 LC_ALL=C make -C doc html
486 find doc -name '*.pyc' -print0 | xargs -0 -r rm -f
488 # Check for gettext support
489 if [ -d po ] ; then
490 echo "* Generating mo files"
491 ./scripts/generate-mo
492 if [ -f ./scripts/remove-incomplete-mo ] ; then
493 echo "* Removing incomplete translations"
494 ./scripts/remove-incomplete-mo
498 if [ -f ./scripts/line-counts.sh ] ; then
499 echo "* Generating line counts"
500 ./scripts/line-counts.sh
503 echo "* Removing unneeded files"
505 # Remove developer information
506 rm -r .github CODE_OF_CONDUCT.md DCO
508 # Testsuite setup
509 rm .scrutinizer.yml .weblate codecov.yml
511 # Remove Doctum config file
512 rm test/doctum-config.php
514 # Remove readme for github
515 rm README.rst
517 if [ -f ./scripts/console ]; then
518 # Update the vendors to have the dev vendors
519 composer update --no-interaction
520 # Warm up the routing cache for 5.1+ releases
521 ./scripts/console cache:warmup --routing
524 PHP_REQ=$(sed -n '/"php"/ s/.*"\^\([0-9]\.[0-9]\.[0-9]\).*/\1/p' composer.json)
526 if [ -z "$PHP_REQ" ] ; then
527 echo "Failed to figure out required PHP version from composer.json"
528 exit 2
531 echo "* Writing the version to composer.json (version: $version)"
532 composer config version "$version"
534 # Okay, there is no way to tell composer to install
535 # suggested package. Let's require it and then revert
536 # composer.json to original state.
537 cp composer.json composer.json.backup
538 COMPOSER_VERSION="$(composer --version)"
539 echo "* Running composer (version: $COMPOSER_VERSION)"
540 composer config platform.php "$PHP_REQ"
541 composer update --no-interaction --no-dev
543 # Parse the required versions from composer.json
544 PACKAGES_VERSIONS=''
545 PACKAGE_LIST='tecnickcom/tcpdf pragmarx/google2fa-qrcode bacon/bacon-qr-code code-lts/u2f-php-server web-auth/webauthn-lib'
547 for PACKAGES in $PACKAGE_LIST
549 PKG_VERSION="$(get_composer_package_version "$PACKAGES")"
550 PACKAGES_VERSIONS="$PACKAGES_VERSIONS $PACKAGES:$PKG_VERSION"
551 done
553 echo "* Installing composer packages '$PACKAGES_VERSIONS'"
555 composer require --no-interaction --update-no-dev $PACKAGES_VERSIONS
557 echo "* Running a security checkup"
558 security_checkup
560 echo "* Cleaning up vendor folders"
561 mv composer.json.backup composer.json
562 cleanup_composer_vendors
564 echo "* Re-generating the autoload class map"
565 # https://getcomposer.org/doc/articles/autoloader-optimization.md#what-does-it-do-
566 # We removed some files, we also need that composer removes them from autoload class maps
567 # If the class is in the class map (as explained in the link above) then it is assumed to exist as a file
568 composer dump-autoload --no-interaction --optimize --dev
570 echo "* Running an autoload checkup"
571 autoload_checkup
573 echo "* Running a security checkup"
574 security_checkup
575 if [ $do_tag -eq 1 ] ; then
576 echo "* Commiting composer.lock"
577 git add --force composer.lock
578 git commit -s -m "Adding composer lock for $version"
581 if [ -f package.json ] ; then
582 echo "* Running Yarn"
583 yarn install --production
586 # Remove git metadata
587 rm .git
588 find . -name .gitignore -print0 | xargs -0 -r rm
589 find . -name .gitattributes -print0 | xargs -0 -r rm
591 if [ $do_test -eq 1 ] ; then
592 # Move the folder out and install dev vendors
593 create_phpunit_sandbox
594 # Backup the files because the new autoloader will change the composer vendor
595 backup_vendor_folder
596 # Generate an autoload for test class files (and include dev namespaces)
597 composer dump-autoload --dev || php -r "echo 'Requires: composer >= v2.1.2' . PHP_EOL; exit(1);"
598 "${TEMP_PHPUNIT_FOLDER}/vendor/bin/phpunit" --no-coverage --testsuite unit
599 test_ret=$?
600 if [ $do_ci -eq 1 ] ; then
601 cd ../..
602 rm -r $workdir
603 git worktree prune
604 if [ "$branch" = "ci" ] ; then
605 git branch -D ci
607 exit $test_ret
609 if [ $test_ret -ne 0 ] ; then
610 exit $test_ret
612 # Remove PHPUnit cache file
613 rm -f .phpunit.result.cache
614 # Generate an normal autoload (this is just a security, because normally the vendor folder will be restored)
615 composer dump-autoload
616 # Remove libs installed for testing
617 rm -r build
618 delete_phpunit_sandbox
619 restore_vendor_folder
622 security_checkup
624 cd ..
626 # Prepare all kits
627 for kit in $KITS ; do
628 echo "* Building kit: $kit"
629 # Copy all files
630 name=$kit_prefix-$kit
631 cp -r $workdir_name $name
633 # Cleanup translations
634 cd $name
635 ./scripts/lang-cleanup.sh $kit
637 # Remove tests, source code,...
638 if [ $kit != source ] ; then
639 echo "* Removing source files"
640 # Testsuite
641 rm -r test/
642 # Template test files
643 rm -r templates/test/
644 rm phpunit.xml.*
645 rm .editorconfig .browserslistrc .eslintignore .jshintrc .eslintrc.json .stylelintrc.json psalm.xml psalm-baseline.xml phpstan.neon.dist phpstan-baseline.neon phpcs.xml.dist jest.config.js infection.json.dist
646 # Gettext po files (if they where not removed by ./scripts/lang-cleanup.sh)
647 rm -rf po
648 # Documentation source code
649 mv doc/html htmldoc
650 rm -r doc
651 mkdir doc
652 mv htmldoc doc/html
653 rm doc/html/.buildinfo doc/html/objects.inv
654 rm -r node_modules
655 # Remove bin files for non source version
656 # https://github.com/phpmyadmin/phpmyadmin/issues/16033
657 rm -r vendor/bin
660 # Remove developer scripts
661 rm -r scripts
663 # Remove possible tmp folder
664 rm -rf tmp
666 cd ..
668 # Remove tar file possibly left from previous run
669 rm -f $name.tar
671 # Prepare distributions
672 for comp in $COMPRESSIONS ; do
673 case $comp in
674 tbz|tgz|txz)
675 if [ ! -f $name.tar ] ; then
676 echo "* Creating $name.tar"
677 tar --owner=root --group=root --numeric-owner --sort=name -cf $name.tar $name
679 if [ $comp = txz ] ; then
680 echo "* Creating $name.tar.xz"
681 xz -9k $name.tar
683 if [ $comp = tgz ] ; then
684 echo "* Creating $name.tar.gz"
685 gzip -9c $name.tar > $name.tar.gz
688 zip-7z)
689 echo "* Creating $name.zip"
690 7za a -bd -tzip $name.zip $name > /dev/null
693 echo "WARNING: ignoring compression '$comp', not known!"
695 esac
696 done
699 # Cleanup
700 rm -f $name.tar
701 # Remove directory with current dist set
702 rm -r $name
703 done
705 # Cleanup
706 rm -r $workdir_name
707 git worktree prune
709 # Signing of files with default GPG key
710 echo "* Signing files"
711 for file in $kit_prefix-*.gz $kit_prefix-*.zip $kit_prefix-*.xz ; do
712 if [ $do_sign -eq 1 ] ; then
713 gpg --detach-sign --armor $file
715 sha1sum $file > $file.sha1
716 sha256sum $file > $file.sha256
717 done
719 if [ $do_daily -eq 1 ] ; then
720 cat > $kit_prefix.json << EOT
722 "date": "`date --iso-8601=seconds`",
723 "commit": "$git_head"
726 exit 0
730 echo ""
731 echo ""
732 echo ""
733 echo "Files:"
734 echo "------"
736 ls -la *.gz *.zip *.xz
738 cd ..
740 # Tag as release
741 if [ $do_tag -eq 1 ] ; then
742 echo
743 echo "Additional tasks:"
744 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
745 echo "* Tagging release as $tagname"
746 git tag -s -a -m "Released $version" $tagname $branch
747 echo " Dont forget to push tags using: git push --tags"
748 echo "* Cleanup of $branch"
749 # Remove composer.lock, but we need to create fresh worktree for that
750 git worktree add --force $workdir $branch
751 cd $workdir
752 git rm --force composer.lock
753 git commit -s -m "Removing composer.lock"
754 cd ../..
755 rm -r $workdir
756 git worktree prune
759 # Mark as stable release
760 if [ $do_stable -eq 1 ] ; then
761 mark_as_release $branch STABLE
764 cat <<END
767 Todo now:
768 ---------
770 1. Push the new tag upstream, with a command like git push origin --tags
772 2. Push the new STABLE branch upstream
774 3. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
775 this release and paste into it the ChangeLog for this release, followed
776 by the notes of all previous incremental versions (i.e. 4.4.9 through 4.4.0)
778 4. upload the files to our file server, use scripts/upload-release, eg.:
780 ./scripts/upload-release $version release
782 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/
784 6. send a short mail (with list of major changes) to
785 developers@phpmyadmin.net
786 news@phpmyadmin.net
788 Don't forget to update the Description section in the announcement,
789 based on documentation.
791 7. increment rc count or version in the repository :
792 - run ./scripts/console set-version $version
793 - in $VERSION_FILE Version class:
794 - check that VERSION, MAJOR, MINOR and PATCH are correct.
795 - in README the "Version" line
796 " Version 2.7.1-dev "
797 - in package.json the line
798 " "version": " 2.7.1-dev", "
799 - in doc/conf.py (if it exists) the line
800 " version = '2.7.1-dev' "
802 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
804 9. for a major release, update demo/php/versions.ini in the scripts repository so that the demo server shows current versions
806 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
808 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 {tagName}