-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
console.php
executable file
·99 lines (88 loc) · 3.66 KB
/
console.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
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
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env php
<?php
declare(strict_types=1);
namespace Laminas\AutomaticReleases\WebApplication;
use ErrorException;
use Http\Discovery\HttpClientDiscovery;
use Http\Discovery\Psr17FactoryDiscovery;
use Laminas\AutomaticReleases\Application\Command\CreateMergeUpPullRequest;
use Laminas\AutomaticReleases\Application\Command\ReleaseCommand;
use Laminas\AutomaticReleases\Environment\EnvironmentVariables;
use Laminas\AutomaticReleases\Git\CreateTagViaConsole;
use Laminas\AutomaticReleases\Git\FetchAndSetCurrentUserByReplacingCurrentOriginRemote;
use Laminas\AutomaticReleases\Git\GetMergeTargetCandidateBranchesFromRemoteBranches;
use Laminas\AutomaticReleases\Git\PushViaConsole;
use Laminas\AutomaticReleases\Github\Api\GraphQL\Query\GetMilestoneFirst100IssuesAndPullRequests;
use Laminas\AutomaticReleases\Github\Api\GraphQL\RunGraphQLQuery;
use Laminas\AutomaticReleases\Github\Api\V3\CreatePullRequestThroughApiCall;
use Laminas\AutomaticReleases\Github\Api\V3\CreateReleaseThroughApiCall;
use Laminas\AutomaticReleases\Github\CreateReleaseTextThroughChangelog;
use Laminas\AutomaticReleases\Github\Event\Factory\LoadCurrentGithubEventFromGithubActionPath;
use Laminas\AutomaticReleases\Github\JwageGenerateChangelog;
use Laminas\AutomaticReleases\Gpg\ImportGpgKeyFromStringViaTemporaryFile;
use PackageVersions\Versions;
use Symfony\Component\Console\Application;
use function set_error_handler;
use const E_NOTICE;
use const E_STRICT;
use const E_WARNING;
(static function (): void {
require_once __DIR__ . '/../vendor/autoload.php';
set_error_handler(
static function (int $errorCode, string $message = '', string $file = '', int $line = 0): bool {
throw new ErrorException($message, 0, $errorCode, $file, $line);
},
E_STRICT | E_NOTICE | E_WARNING
);
$variables = EnvironmentVariables::fromEnvironment(new ImportGpgKeyFromStringViaTemporaryFile());
$loadEvent = new LoadCurrentGithubEventFromGithubActionPath($variables);
$fetch = new FetchAndSetCurrentUserByReplacingCurrentOriginRemote($variables);
$getCandidateBranches = new GetMergeTargetCandidateBranchesFromRemoteBranches();
$makeRequests = Psr17FactoryDiscovery::findRequestFactory();
$httpClient = HttpClientDiscovery::find();
$githubToken = $variables->githubToken();
$getMilestone = new GetMilestoneFirst100IssuesAndPullRequests(new RunGraphQLQuery(
$makeRequests,
$httpClient,
$githubToken
));
$createReleaseText = new CreateReleaseTextThroughChangelog(JwageGenerateChangelog::create(
$makeRequests,
$httpClient
));
$push = new PushViaConsole();
$createRelease = new CreateReleaseThroughApiCall(
$makeRequests,
$httpClient,
$githubToken
);
$application = new Application(Versions::ROOT_PACKAGE_NAME, Versions::getVersion('laminas/automatic-releases'));
$application->addCommands([
new ReleaseCommand(
$variables,
$loadEvent,
$fetch,
$getCandidateBranches,
$getMilestone,
$createReleaseText,
new CreateTagViaConsole(),
$push,
$createRelease
),
new CreateMergeUpPullRequest(
$variables,
$loadEvent,
$fetch,
$getCandidateBranches,
$getMilestone,
$createReleaseText,
$push,
new CreatePullRequestThroughApiCall(
$makeRequests,
$httpClient,
$githubToken
)
),
]);
$application->run();
})();