-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from sstok/release-3.0.0
Release v3.0.0
- Loading branch information
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Psr\Container\ContainerInterface as Container; | ||
use Rollerworks\Component\Version\Version; | ||
use Symfony\Component\Console\Helper\ProgressIndicator; | ||
|
||
return function (Container $container, Version $version, string $branch, ?string $releaseTitle, string $changelog) { | ||
/** @var \Psr\Log\LoggerInterface $logger */ | ||
$logger = $container->get('logger'); | ||
/** @var \HubKit\Service\GitHub $github */ | ||
$github = $container->get('github'); | ||
/** @var \HubKit\Service\Git\GitBranch $gitBranch */ | ||
$gitBranch = $container->get('git.branch'); | ||
|
||
/** @var \Symfony\Component\Console\Style\SymfonyStyle $style */ | ||
$style = $container->get('style'); | ||
|
||
$logger->info('Preparing new release branch'); | ||
$gitBranch->checkoutNew($releaseBranch = 'release-'.$version->full); | ||
|
||
$logger->info('Updating composer branch-alias'); | ||
$container->get('process')->mustRun(['composer', 'config', 'extra.branch-alias.dev-'.$branch, sprintf('%d.%d-dev', $version->major, $version->minor)]); | ||
|
||
$gitBranch->add('composer.json'); | ||
$gitBranch->commit('Update composer branch-alias'); | ||
|
||
$gitBranch->pushToRemote('origin', $releaseBranch); | ||
|
||
$pr = $github->openPullRequest($branch, $releaseBranch, 'Release v'.$version->full, 'This might be a good place for a changelog.'); | ||
|
||
$style->warning([ | ||
'Pull request '.$pr['html_url'].' was opened for this release.', | ||
'The process will automatically continue once this pull request it merged.', | ||
'!! DO NOT ABORT THE COMMAND !!' | ||
]); | ||
|
||
$progress = new ProgressIndicator($style); | ||
$progress->start('Waiting for pull request to be merged.'); | ||
|
||
// Wait till the pull-request is merged. This might crash if the API limit is exceeded. | ||
while ($github->getPullRequest($pr['number'])['state'] === 'open') { | ||
sleep(30); // sleep for 30 seconds | ||
|
||
$progress->advance(); | ||
} | ||
|
||
if ($github->getPullRequest($pr['number'])['state'] === 'closed') { | ||
$progress->finish('Pull request was closed. Aborting.'); | ||
|
||
exit(1); | ||
} | ||
|
||
$progress->finish('Pull request was merged, continuing.'); | ||
$gitBranch->pullRemote('upstream', $branch); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "sebastiaanstok/experiments-sandbox", | ||
"authors": [ | ||
{ | ||
"name": "Sebastiaan Stok", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": {}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "3.0-dev" | ||
} | ||
} | ||
} |