Skip to content

Commit

Permalink
Merge pull request #18 from weierophinney/feature/keep-a-changelog
Browse files Browse the repository at this point in the history
Allow using existing Keep-A-Changelog files for release notes
  • Loading branch information
Ocramius authored Aug 6, 2020
2 parents d320395 + 7d9c597 commit 0bd9b0e
Show file tree
Hide file tree
Showing 20 changed files with 2,730 additions and 267 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 1.1.0 - TBD

### Added

- [#18](https://github.com/laminas/automatic-releases/pull/18) adds support for using `CHANGELOG.md` files in [Keep-A-Changelog](https://keepachangelog.com) format for the release notes. When such a file is found, the tooling will set the release date in the file, commit and push it, and then extract that changelog version to use in the release notes. It still pulls release notes from patches associated with the milestone as well, in order to provide attribution and provide additional insight into the changes associated with the release.

### Changed

- Nothing.

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- Nothing.
19 changes: 16 additions & 3 deletions bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
use Laminas\AutomaticReleases\Application\Command\CreateMergeUpPullRequest;
use Laminas\AutomaticReleases\Application\Command\ReleaseCommand;
use Laminas\AutomaticReleases\Application\Command\SwitchDefaultBranchToNextMinor;
use Laminas\AutomaticReleases\Changelog\CommitReleaseChangelogViaKeepAChangelog;
use Laminas\AutomaticReleases\Environment\EnvironmentVariables;
use Laminas\AutomaticReleases\Git\CommitFileViaConsole;
use Laminas\AutomaticReleases\Git\CreateTagViaConsole;
use Laminas\AutomaticReleases\Git\FetchAndSetCurrentUserByReplacingCurrentOriginRemote;
use Laminas\AutomaticReleases\Git\GetMergeTargetCandidateBranchesFromRemoteBranches;
Expand All @@ -21,10 +23,13 @@
use Laminas\AutomaticReleases\Github\Api\V3\CreatePullRequestThroughApiCall;
use Laminas\AutomaticReleases\Github\Api\V3\CreateReleaseThroughApiCall;
use Laminas\AutomaticReleases\Github\Api\V3\SetDefaultBranchThroughApiCall;
use Laminas\AutomaticReleases\Github\ConcatenateMultipleReleaseTexts;
use Laminas\AutomaticReleases\Github\CreateReleaseTextThroughChangelog;
use Laminas\AutomaticReleases\Github\CreateReleaseTextViaKeepAChangelog;
use Laminas\AutomaticReleases\Github\Event\Factory\LoadCurrentGithubEventFromGithubActionPath;
use Laminas\AutomaticReleases\Github\JwageGenerateChangelog;
use Laminas\AutomaticReleases\Gpg\ImportGpgKeyFromStringViaTemporaryFile;
use Lcobucci\Clock\SystemClock;
use PackageVersions\Versions;
use Symfony\Component\Console\Application;

Expand Down Expand Up @@ -56,17 +61,24 @@ static function (int $errorCode, string $message = '', string $file = '', int $l
$httpClient,
$githubToken
));
$createReleaseText = new CreateReleaseTextThroughChangelog(JwageGenerateChangelog::create(
$commit = new CommitFileViaConsole();
$push = new PushViaConsole();
$commitChangelog = new CommitReleaseChangelogViaKeepAChangelog(new SystemClock(), $commit, $push);
$createCommitText = new CreateReleaseTextThroughChangelog(JwageGenerateChangelog::create(
$makeRequests,
$httpClient
));
$push = new PushViaConsole();
$createReleaseText = new ConcatenateMultipleReleaseTexts([
new CreateReleaseTextViaKeepAChangelog(),
$createCommitText,
]);
$createRelease = new CreateReleaseThroughApiCall(
$makeRequests,
$httpClient,
$githubToken
);

/** @psalm-suppress DeprecatedClass */
$application = new Application(Versions::ROOT_PACKAGE_NAME, Versions::getVersion('laminas/automatic-releases'));

$application->addCommands([
Expand All @@ -76,6 +88,7 @@ static function (int $errorCode, string $message = '', string $file = '', int $l
$fetch,
$getCandidateBranches,
$getMilestone,
$commitChangelog,
$createReleaseText,
new CreateTagViaConsole(),
$push,
Expand All @@ -87,7 +100,7 @@ static function (int $errorCode, string $message = '', string $file = '', int $l
$fetch,
$getCandidateBranches,
$getMilestone,
$createReleaseText,
$createCommitText,
$push,
new CreatePullRequestThroughApiCall(
$makeRequests,
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
},
"require": {
"php": "^7.4.7",
"composer/package-versions-deprecated": "^1.10.99",
"jwage/changelog-generator": "^1.2.1",
"laminas/laminas-diactoros": "^2.3.1",
"ocramius/package-versions": "^1.9",
"lcobucci/clock": "^1.3",
"phly/keep-a-changelog": "^2.8",
"php-http/curl-client": "^2.1.0",
"php-http/discovery": "^1.9.1",
"php-http/httplug": "^2.1.0",
Expand Down
Loading

0 comments on commit 0bd9b0e

Please sign in to comment.