-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.php
More file actions
89 lines (78 loc) · 2.8 KB
/
release.php
File metadata and controls
89 lines (78 loc) · 2.8 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
namespace Deployer;
use Deployer\Exception\Exception;
use Deployer\Task\GroupTask;
use Symfony\Component\Console\Helper\Table;
task('dev:release', [
'dev:release:pre',
'dev:release:tabula_rasa',
'dev:release:start_new_release',
'dev:release:steps',
'dev:release:post'
])->desc('Generate a new release');
task('dev:release:steps', [
'dev:release:composer_update_app',
'dev:release:composer_update_ci',
'dev:release:npm_update',
'dev:release:qa:php',
'dev:release:qa:npm',
'dev:release:test:acceptance',
])->desc('Defines the single steps for the release preparation');
task('dev:release:pre', function () {
/* get new version */
getNewVersion();
/* check if everything is clear */
info("🔍 Checking composer.json");
runLocally("composer validate --working-dir " . get('composer_path_app'));
/* select steps to execute */
if (!input()->getOption('no-interaction')) {
info("Which steps of the task \"dev:release:steps\" shall be executed? (hint: skip the selection with \"--no-interaction\")");
foreach (getSubTask('dev:release:steps') as $step) {
$result = ask("$step", "yes");
if ($result !== "yes" && $result !== "y") {
// disabling a task on runtime does not work
// task($step)->disable();
add('dev_disabled_tasks', [$step]);
warning("Task \"$step\" disabled");
}
}
}
})->desc('Prepares the release process');
task('dev:release:post', function () {
$version = get('new_version');
info("🚀 Successfully prepared new release $version");
$rows = [];
foreach(getSubTask('dev:release') as $task) {
if (is_array(get('dev_disabled_tasks')) && in_array($task, get('dev_disabled_tasks'))) {
$rows[] = [
$task,
'⏭️'
];
continue;
}
if (is_array(get('dev_empty_tasks')) && in_array($task, get('dev_empty_tasks'))) {
$rows[] = [
$task,
'0️⃣'
];
continue;
}
$rows[] = [
$task,
'✅️'
];
}
(new Table(output()))
->setHeaderTitle($version)
->setHeaders(['Task', 'Status'])
->setRows($rows)
->render();
warning("⚠️ Please check your git log and verify all automated git commits before pushing them!");
if (is_array(get('dev_additional_warnings'))) {
foreach(get('dev_additional_warnings') as $warning) {
warning($warning);
}
}
info("ℹ️ Don't forget to \"git push\"");
info("💡Use the command \"dep dev:release:finish\" to finish the release process after merging features and bug fixes.");
})->desc('Finish the release preparation');