Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function handle(): void |
||
16 | { |
||
17 | $commitMessage = trim(exec('git log --pretty="%s" -n1 HEAD')); |
||
18 | |||
19 | if (preg_match('#Merge branch \'release/(.*?)\'#is', $commitMessage, $matches)) |
||
20 | { |
||
21 | $version = $matches[1]; |
||
22 | |||
23 | if (! empty($version)) |
||
24 | { |
||
25 | $envFilePath = base_path('/.env'); |
||
26 | $envFileData = file_get_contents($envFilePath); |
||
27 | |||
28 | $envFileData = preg_replace( |
||
29 | '#^APP_VERSION=(.*?)$#im', |
||
30 | sprintf('APP_VERSION=%s', $version), |
||
31 | $envFileData |
||
32 | ); |
||
33 | |||
34 | file_put_contents($envFilePath, $envFileData); |
||
35 | |||
36 | $this->info(sprintf('Set APP version: %s', $version)); |
||
37 | } |
||
41 |