mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Add workflow and script for updating changelog
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
name: Update Changelog
|
||||
|
||||
jobs:
|
||||
release:
|
||||
# Prevent this workflow from running elsewhere.
|
||||
if: github.repository_owner == 'php-curl-class'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Update list
|
||||
run: python scripts/update_changelog.py
|
||||
@@ -4,6 +4,8 @@ PHP Curl Class uses semantic versioning with version numbers written as `MAJOR.M
|
||||
`MINOR` and `PATCH` version changes. It is recommended to review `MAJOR` changes prior to upgrade as there may be
|
||||
backwards-incompatible changes that will affect existing usage.
|
||||
|
||||
<!-- CHANGELOG_PLACEHOLDER -->
|
||||
|
||||
## 9.6.1 - 2022-06-30
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
CURRENT_FILE = Path(__file__)
|
||||
ROOT = CURRENT_FILE.parents[1]
|
||||
|
||||
|
||||
def main():
|
||||
# TODO: Fetch actual semantic version.
|
||||
release_version = '9.6.2'
|
||||
release_date = datetime.today().strftime('%Y-%m-%d')
|
||||
release_title = '{} - {}'.format(release_version, release_date)
|
||||
|
||||
# TODO: Fetch actual list of changes.
|
||||
release_changes = 'Some change'
|
||||
release_content = (
|
||||
'## {}\n'
|
||||
'\n'
|
||||
'{}'
|
||||
).format(release_title, release_changes)
|
||||
|
||||
changelog_path = ROOT / 'CHANGELOG.md'
|
||||
old_content = changelog_path.read_text()
|
||||
new_content = old_content.replace(
|
||||
'<!-- CHANGELOG_PLACEHOLDER -->',
|
||||
'<!-- CHANGELOG_PLACEHOLDER -->\n\n{}'.format(release_content),
|
||||
)
|
||||
print(new_content[:500])
|
||||
changelog_path.write_text(new_content)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user