wnx/changelog-updater
Composer 安装命令:
composer require wnx/changelog-updater
包简介
PHP CLI to update a CHANGELOG following the "Keep a Changelog" format with the latest release notes.
README 文档
README
A PHP CLI to update a changelog with the latest release notes.
Want to automate the process of updating your changelog with GitHub Actions? Checkout the stefanzweifel/changelog-updater-action which does exactly that.
If your changelog follows the "Keep a Changelog" format and has a "Unreleased" heading in it, the CLI will update the link in and place the release notes below heading.
Installation
You can install the changelog-updater CLI as a composer dependency in your project or globally. It requires PHP 8.2 or higher.
composer global require wnx/changelog-updater
Usage
You can use changelog-updater by running the update command with the following options.
php changelog-updater update \ --release-notes="### Added - New Feature A - New Feature B ### Changed - Update Feature C ### Removes - Remove Feature D" \ --latest-version="v1.0.0" \ --release-date="2021-08-07" \ --path-to-changelog="CHANGELOG.md" \ --compare-url-target-revision="1.x" \ --write
--release-date, --path-to-changelog, --compare-url-target-revision and --write are optional. Learn more about the options by running php changelog-updater update --help.
If a given version already exists in the CHANGELOG, the CLI will display a warning and not update the CHANGELOG.
CLI Options
--release-notes
Required. The release notes you want to add to your changelog. Should be markdown.
--latest-version
Required. Version number of the latest release. The value will be used as the heading text if --heading-text is not set. If the changelog has a "Unreleased" heading, the value will be used in the updated compare URL.
Example: v1.0.0
--release-date
Optional (Defaults to current date). The date the latest version has been released. The value will be used in the release heading.
--path-to-changelog
Optional (Defaults to CHANGELOG.md). Path to CHANGELOG.md file.
--compare-url-target-revision
Optional (Defaults to HEAD). If the changelog has a "Unreleased" heading, the value will be used together with the --latest-version value in the updated compare URL.
--write
Optional. Write the changes to CHANGELOG.md or to the value of --path-to-changelog.
--github-actions-output
Optional. Will output values for UNRELEASED_COMPARE_URL and RELEASE_COMPARE_URL that can be picked up by GitHub Actions and further used in ones Workflow.
--heading-text
Optional (Defaults to value of --latest-version). The text value used in the heading that is created for the new release.
## heading-text - 2021-02-01 ## [heading-text](https://github.com/org/repo/compare/v0.1.0...v1.0.0) - 2021-02-01
--parse-release-notes
Optional. Tell the CLI explicitly to use the content between an "Unreleased Heading" and the previous version heading as release notes. The value from --release-notes will be ignored.
--hide-release-date
Optional. Don't add the release date to the release heading.
--parse-github-usernames
Optional. Look for GitHub usernames in --release-notes and linkify them. Currently not supported for release notes that are located in the existing changelog.
- Added a new feature @stefanzweifel + Added a new feature [@stefanzweifel](https://github.com/stefanzweifel)
Expected Changelog Formats
The CLI does its best to place the given release notes in the right place.
The CLI looks for the first second level heading in your current CHANGELOG.md file. It assumes that this heading represents the previous version. Here is an example of a CHANGELOG.md that the CLI can understand.
# Changelog
## v1.0.0 - 2021-11-01
### Added
- Initial Release
The CLI will then place the new version and its release notes above the existing versions.
# Changelog + ## v1.1.0 - 2021-11-10 + + ### Added + + * New Feature + ## v1.0.0 - 2021-11-01 ### Added * Initial Release
If the changelog does not contain a second level heading, it considers the changelog to be "empty". It will then place the release notes at the bottom of the document.
# Changelog All notable changes to this project will be documented in this file. +## v1.0.0 - 2021-11-01 + +### Added + +* Initial Release
If your changelog follows the "Keep a Changelog" format and contains an "Unreleased"-heading with a link to the repository compare view, the CLI will automatically update the link in the Unreleased heading.
Here is an example of a changelog, before it is updated with the CLI.
# Changelog
## [Unreleased](https://github.com/org/repo/compare/v1.0.0...HEAD)
Please do not update the unreleased notes.
<!-- Content should be placed here -->
## v1.0.0 - 2021-01-01
### Added
- Initial Release
Below you find a diff-view of how the CLI will update the changelog.
# Changelog +## [Unreleased](https://github.com/org/repo/compare/v1.1.0...HEAD) -## [Unreleased](https://github.com/org/repo/compare/v1.0.0...HEAD) Please do not update the unreleased notes. <!-- Content should be placed here --> +## [v1.1.0](https://github.com/org/repo/compare/v1.0.0...v1.1.0) - 2021-02-01 + +### Added + +* New Feature A +* New Feature B + ## v1.0.0 - 2021-01-01 ### Added * Initial Release
The content between the "Unreleased"-heading and the latest version will remain untouched by the CLI.
If you don't have a "Unreleased"-heading in your changelog, but the headings of your previous releases contain a link to the repository compare view, the CLI will add links to the compare view to the added release heading.
# Changelog +## [v1.1.0](https://github.com/org/repo/compare/v1.0.0...v1.1.0) - 2021-02-01 + +### Added + +* New Feature A +* New Feature B + ## [v1.0.0](https://github.com/org/repo/compare/v0.1.0...v1.0.0) - 2021-01-01 ### Added * Initial Release
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
wnx/changelog-updater 适用场景与选型建议
wnx/changelog-updater 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 352 次下载、GitHub Stars 达 28, 最近一次更新时间为 2021 年 08 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「console」 「changelog」 「keep-a-changelog」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wnx/changelog-updater 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wnx/changelog-updater 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wnx/changelog-updater 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This class provides you with an easy-to-use interface to progress bars.
A Laravel package to retrieve data from Google Search Console
Additional artisan commands for Laravel
A Deployment/Change Log Schedule and Notes system for SilverStripe sites
A table generator class for the PHP CLI.
Package to enable change logs to be parsed
统计信息
- 总下载量: 352
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 28
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-07