Skip to content

Commit

Permalink
Merge pull request #68 from sstok/release-3.0.0
Browse files Browse the repository at this point in the history
Release v3.0.0
  • Loading branch information
sstok authored Jul 4, 2019
2 parents 73a4403 + 4444d07 commit e14736d
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor/
57 changes: 57 additions & 0 deletions .hubkit/pre-release.php
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);
};
15 changes: 15 additions & 0 deletions composer.json
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"
}
}
}

0 comments on commit e14736d

Please sign in to comment.