Skip to content

Commit 468e53c

Browse files
wip release command
1 parent 793947e commit 468e53c

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

packages/monorepo/src/Commands/CreateRelease.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,20 @@ public function handle(): int
179179
$this->line('📦 Preparing public packages for workflow...');
180180
$publicPackagesJson = $this->preparePackagesForWorkflow($publicPackagesWithMessages);
181181

182+
$this->githubService->createRelease(
183+
config('monorepo.github_org').'/'.config('monorepo.public_repo'),
184+
$newVersion,
185+
'Release '.$newVersion,
186+
'main'
187+
);
188+
189+
$this->githubService->createRelease(
190+
config('monorepo.github_org').'/'.config('monorepo.private_repo'),
191+
$newVersion,
192+
'Release '.$newVersion,
193+
'main'
194+
);
195+
182196
$this->githubService->triggerWorkflowDispatch(
183197
config('monorepo.github_org'),
184198
config('monorepo.public_repo'),

packages/monorepo/src/Services/GitHubService.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,6 @@ public function triggerWorkflowDispatch(string $org, string $repo, string $workf
7979
{
8080
$url = "https://api.github.com/repos/{$org}/{$repo}/actions/workflows/{$workflowId}/dispatches";
8181

82-
// Automatically add user information to inputs
83-
$user = $this->getCurrentUser();
84-
if ($user && ! isset($inputs['user_name']) && ! isset($inputs['user_email'])) {
85-
$inputs['user_name'] = $user['name'] ?? $user['login'] ?? 'Unknown User';
86-
$inputs['user_email'] = $user['email'] ?? $user['login'].'@users.noreply.github.com';
87-
}
88-
8982
$data = [
9083
'ref' => $ref,
9184
];
@@ -97,9 +90,9 @@ public function triggerWorkflowDispatch(string $org, string $repo, string $workf
9790
return $this->postJson($url, $data);
9891
}
9992

100-
public function createRelease(string $repoFullName, string $version, ?string $body = null, string $targetCommitish = 'main'): ?array
93+
public function createRelease(string $org, string $repo, string $version, ?string $body = null, string $targetCommitish = 'main'): ?array
10194
{
102-
$url = "https://api.github.com/repos/{$repoFullName}/releases";
95+
$url = "https://api.github.com/repos/{$org}/{$repo}/releases";
10396

10497
// Detect if this is a prerelease (alpha, beta, rc)
10598
$isPrerelease = preg_match('/-(alpha|beta|rc)\b/i', $version);
@@ -117,9 +110,9 @@ public function createRelease(string $repoFullName, string $version, ?string $bo
117110
return $this->postJson($url, $data);
118111
}
119112

120-
public function getLatestReleaseTag(string $repoFullName): string
113+
public function getLatestReleaseTag(string $org, string $repo): string
121114
{
122-
$data = $this->fetchJson("https://api.github.com/repos/{$repoFullName}/releases/latest");
115+
$data = $this->fetchJson("https://api.github.com/repos/{$org}/{$repo}/releases/latest");
123116

124117
return $data['name'] ?? 'No release';
125118
}

0 commit comments

Comments
 (0)