llaville / php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions
https://llaville.github.io/php-compatinfo-db/6.13/
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

[automation] Build CHANGELOG #130

Closed llaville closed 2 years ago

llaville commented 2 years ago

New Feature request

Summary

Replace legacy build CHANGELOG process by Changie tool.

Description

Legacy build CHANGELOG process suffer from a little problem that may cause git merge conflicts if it not well handled. Using Mardown custom tags <!-- MARKDOWN-RELEASE:START --> and <!-- MARKDOWN-RELEASE:END -->

Solution

Do not use anymore the custom Markdown tags and separate changelog from commit messages without conflicts with Changie tool.

llaville commented 2 years ago

Scheduled for upcoming version 4.10.0 ! As PHP 8.2 seems to have a new Release Candidate (RC7) planned for November 24

llaville commented 2 years ago

We will use the latest version v1.10.0 of Changie on this migration.

And run the docker image as non-root user :

docker run --rm --user $(id -u):$(id -g) --mount type=bind,source=$PWD,target=/src -w /src  ghcr.io/miniscruff/changie:v1.10.0
llaville commented 2 years ago

Step 1 : Initialize Changie environment with init command.

Will built following files

.changes/
├── header.tpl.md
└── unreleased
    └── .gitkeep
.changie.yaml
CHANGELOG.md
llaville commented 2 years ago

Step 2 : Customize Changie Header Template file .changes/header.tpl.md

From default value

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

To this content, related to CompatInfoDB project

<!-- markdownlint-disable MD013 MD024 -->
# Changes CompatInfoDB 4.x

All notable changes of the CompatInfoDB 4 release series will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
llaville commented 2 years ago

Step 3 : Customize Changie configuration file .changie.yaml

From default value

changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '* {{.Body}}'
kinds:
- label: Added
- label: Changed
- label: Deprecated
- label: Removed
- label: Fixed
- label: Security
newlines:
  afterChangelogHeader: 1
  beforeChangelogVersion: 1
  endOfVersion: 1
envPrefix: CHANGIE_

To this content, to avoid Mardown linter to raise errors

changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '* {{.Body}}'
kinds:
    - label: Added
    - label: Changed
    - label: Deprecated
    - label: Removed
    - label: Fixed
    - label: Security
newlines:
    afterHeaderTemplate: 0
    beforeKind: 1
    afterKind: 1
    beforeVersion: 1
    endOfVersion: 1
envPrefix: CHANGIE_
llaville commented 2 years ago

Step 4 : Follows Backup Changie recommendation on old changelog to keep existing changes on major version 4.x

Copy CHANGELOG-4.x.md to .changes/4.9.0.md

Clean-up a bit contents by removing header, unreleased section, and full changelog links at bottom of file .changes/4.9.0.md

llaville commented 2 years ago

Without anything else, Changie is able to generate almost an equivalent to current CHANGELOG-4.x.md with the merge command.

This will finish the basic tutorial of Changie migration for this project.

llaville commented 2 years ago

Integrated with .github/workflows/release.yml and ready for next version 4.10.0