Skip to content

Commit e7f4bce

Browse files
authored
fix: Release note creation (open-component-model#1893)
<!-- markdownlint-disable MD041 --> #### What this PR does / why we need it 1. Release note header is not correctly replaced because the regex assumed the line would start with `[` but it actually starts with `## [`. The changed implementation now checks for a line starting with `## [cli/` and will only replace it on the first line. This should work as long no one wants to break this by intend. However, the PR title checker should prevent this. 2. Added a quick installation and usage guide for the ocm cli. The script cannot be used yet because we need to finish the [implementation](https://github.com/open-component-model/ocm-website/pull/738/changes). #### Which issue(s) this PR fixes Fixes open-component-model/ocm-project#923 #### Testing - Tested release notes title replacement locally by using ```js const fs = require('fs'); const finalTag = "cli/v0.1.0"; const rcTag = "cli/v0.1.0-rc.1"; const notesFile = "notes.md"; let notes = fs.existsSync(notesFile) ? fs.readFileSync(notesFile, 'utf8').trim() : `Promoted from ${rcTag}`; // Replace RC header with final release header by replacing the whole line // From: "[cli/v0.17.0-rc.1] - 2026-02-02" // To: "[cli/v0.17.0] - promoted from [cli/v0.17.0-rc.1] on 2026-02-16" // Assumption: There is only one line starting with "## [cli/" in the notes file, which is the RC header. // If there are multiple, this will only replace the first one. const today = new Date().toISOString().split('T')[0]; notes = notes.replace( /^## \[cli\/.*/, `## [${finalTag}] - promoted from [${rcTag}] on ${today}` ); console.log(notes); ``` and the release notes from [`0.1.0-rc.1`](https://github.com/open-component-model/open-component-model/releases/tag/cli%2Fv0.1.0-rc.1) in the respective file: ```bash $> node test-release-notes.js | head -n 20 ## [cli/v0.1.0] - promoted from [cli/v0.1.0-rc.1] on 2026-03-04 ### 🚀 Features - Migrate configuration v1 (#35) ... ``` - Testing release notes creation with `git-cliff` - Install `git-cliff` using `brew install git-cliff` - Run ```bash $> git-cliff \ --config cli/cliff.toml \ --include-path "cli/**" \ --tag-pattern "^cli/v\\d+\\.\\d+\\.\\d+(?:[-\\w\\.]+)?$" \ --ignore-tags "^cli/v\\d+\\.\\d+\\.\\d+-rc\\.\\d+$" \ --tag "cli/v0.1.0" \ -o "CHANGELOG.md" \ --use-branch-tags \ --latest ``` - Check `./CHANGELOG.md` (using a picture here because md-formatting in md-formatting cannot be properly processed by GitHub) <img width="776" height="312" alt="image" src="https://github.com/user-attachments/assets/4f4d58a3-64fa-4149-8472-bc626c5dd403" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added a quick installation and usage guide with curl and Docker commands to the changelog. * **Chores** * Improved release notes header handling for final releases: stricter header validation, early failure when the expected header is missing, and replacement of the RC header line with the final header (including tag and promotion date); clarified inline comments. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Frederic Wilhelm <frederic.wilhelm@sap.com>
1 parent 3c1510c commit e7f4bce

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

.github/workflows/cli-release.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,19 @@ jobs:
375375
? fs.readFileSync(notesFile, 'utf8').trim()
376376
: `Promoted from ${rcTag}`;
377377
378-
// Replace RC header with final release header
378+
// Replace RC header with final release header by replacing the whole line
379379
// From: "[cli/v0.17.0-rc.1] - 2026-02-02"
380380
// To: "[cli/v0.17.0] - promoted from [cli/v0.17.0-rc.1] on 2026-02-16"
381381
const today = new Date().toISOString().split('T')[0];
382+
// Regex to match the RC header line, ensuring it starts with "## [cli/v" and contains "-rc."
383+
const rcHeaderPattern = /^## \[cli\/v\d+\.\d+\.\d+-rc\.\d+\].*$/m;
384+
if (!rcHeaderPattern.test(notes)) {
385+
core.setFailed(`RC header not found in release notes for ${rcTag}`);
386+
return;
387+
}
382388
notes = notes.replace(
383-
/^\[([^\]]+)\]\s*-\s*[\d-]+/,
384-
`[${finalTag}] - promoted from [${rcTag}] on ${today}`
389+
rcHeaderPattern,
390+
`## [${finalTag}] - promoted from [${rcTag}] on ${today}`
385391
);
386392
387393
// Use make_latest to control whether this release is marked as "latest"

cli/cliff.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@ body = """
1919
{{ commit.message | upper_first }}\
2020
{% endfor %}
2121
{% endfor %}
22+
23+
### Quick installation and usage guide
24+
25+
To install the latest version of OCM, you can use the following command:
26+
27+
```bash
28+
curl -fsSL https://ocm.software/install-cli.sh | sudo bash
29+
```
30+
31+
(For more installation options, check out our [installation guide](https://ocm.software/dev/docs/getting-started/install-the-ocm-cli/).)
32+
33+
You can also use our container to run OCM without installing it:
34+
35+
```bash
36+
docker run -t ghcr.io/open-component-model/cli:latest --help
37+
```
38+
39+
Check out our [guide](https://ocm.software/dev/docs/how-to/how-to-use-the-ocm-cli-container-image/) on how to use the
40+
OCM CLI container image for more details.
41+
2242
{% if github.contributors | length > 0 %}
2343
### Community & Contributors
2444

0 commit comments

Comments
 (0)