-
Notifications
You must be signed in to change notification settings - Fork 4
/
release.php
47 lines (37 loc) · 1.58 KB
/
release.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php declare(strict_types=1);
require_once __DIR__ . '/../../../../vendor/autoload.php';
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
const COMPOSER_JSON_DEST = __DIR__ . '/../composer.json';
const SYS_TMP_DIR = __DIR__ . '/../';
const TMP_DIR = __DIR__ . '/../';
const SHOPWARE_VERSIONS = '6.6.*';
// Type of release you are making
const RELEASE_GIT_ENV = 'GIT';
const RELEASE_SW_ENV = 'SW';
$release_env = ($argv[1] == RELEASE_SW_ENV) ? RELEASE_SW_ENV : RELEASE_GIT_ENV;
$formatter = new LineFormatter(null, null, false, true);
$logger = (new Logger('release'))
->pushHandler((new StreamHandler('php://stdout'))->setFormatter($formatter));
$composerJsonData = json_decode(file_get_contents(COMPOSER_JSON_DEST), true);
$composerJsonData['require']['shopware/core'] = SHOPWARE_VERSIONS;
$composerJsonData['require']['shopware/storefront'] = SHOPWARE_VERSIONS;
switch ($release_env) {
case RELEASE_GIT_ENV:
exec('composer require wallee/sdk 4.0.2 -d /var/www/shopware.local');
$composerJsonData['require']['wallee/sdk'] = '4.0.2';
break;
case RELEASE_SW_ENV:
exec('composer require wallee/sdk 4.0.2 -d /var/www/shopware.local/custom/plugins/WalleePayment');
break;
}
$composerJsonData['version'] = '6.1.1';
$logger->info('Adding shopware/core and shopware/storefront to the composer.json.');
file_put_contents(
TMP_DIR . '/composer.json',
json_encode($composerJsonData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
);
chdir(TMP_DIR);
exec('rm -fr composer.lock');
exec('rm -fr bin');