fix(release): use inline presetConfig for release-notes-generator
Problem
The release:prepare job fails during the generateNotes step with:
TypeError: Invalid date
at dateformat (load-changelog-config.js:30:107)
See failed job: https://gitlab.com/gitlab-org/container-registry/-/jobs/13099243605
Root Cause
!2753 (merged) configured @semantic-release/release-notes-generator to use .conventional-changelog.js via the config option. Unfortunately, semantic-release and conventional-changelog-cli have different expectations for config files:
-
conventional-changelog-cliaccepts a plain object export (what.conventional-changelog.jsprovides) -
@semantic-release/release-notes-generatorexpects theconfigoption to point to a preset module that exports a function
This mismatch causes the committerDate field to be passed as an empty object {} instead of a date string, which makes dateformat throw "Invalid date".
Since make release-dry-run uses conventional-changelog-cli (which works fine with the config), the issue only surfaced in CI where semantic-release is used.
Fix
This MR:
-
Fixes
.releaserc.yml- Uses inlinepresetandpresetConfigoptions, which is the supported way to customize the conventionalcommits preset for semantic-release -
Creates
.changelog.config.js- A proper config file forconventional-changelog-cliusingwriterOpts.transformto include build/refactor commits and apply custom emoji section headers -
Updates CI jobs to use the new config file with
-n ./.changelog.config.js -
Adds
release:dry-runjob - For testing release configuration changes without side effects -
Refactors release CI configuration:
- Extracts common config to
.gitlab/ci/release_common.yml - Defines package versions as CI variables (single source of truth)
- Creates reusable base configurations (
.release_base,.release_push_base,.release_test_base)
- Extracts common config to
-
Removes
.conventional-changelog.js- No longer needed
Notes
The type-to-section mapping is defined in two places:
-
.releaserc.yml(for semantic-release) -
.changelog.config.js(for conventional-changelog-cli)
Both files have comments pointing to each other. If you update the types in one, update the other too.