Skip to content

Commit 7743f53

Browse files
committed
ci: filter internal release notes
1 parent 035fd78 commit 7743f53

5 files changed

Lines changed: 66 additions & 5 deletions

File tree

.github/workflows/prepare-release.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ jobs:
7474
date = ENV.fetch("DATE")
7575
7676
EMOJI_HEADINGS = ["### ✨", "### 🔄", "### 🐛", "### 🔧", "### 📚", "### 🧪", "### 📦", "### 🧱"].freeze
77+
PUBLIC_RELEASE_NOTE_EXCLUDED_HEADINGS = ["### 🔧 CI/CD"].freeze
7778
7879
def extract_unreleased(path)
7980
content = File.read(path)
@@ -89,6 +90,21 @@ jobs:
8990
body
9091
end
9192
93+
def public_release_notes(markdown)
94+
skip_section = false
95+
markdown.each_line.each_with_object([]) do |line, lines|
96+
stripped = line.strip
97+
if stripped.start_with?("### ")
98+
skip_section = PUBLIC_RELEASE_NOTE_EXCLUDED_HEADINGS.include?(stripped)
99+
next if skip_section
100+
elsif stripped.start_with?("## ")
101+
skip_section = false
102+
end
103+
104+
lines << line unless skip_section
105+
end.join.strip
106+
end
107+
92108
gradle = File.read("gradle.properties")
93109
gradle.sub!(/^version\s*=.*$/, "version = #{version}")
94110
File.write("gradle.properties", gradle)
@@ -105,6 +121,8 @@ jobs:
105121
106122
notes_en = extract_unreleased("CHANGELOG.md")
107123
notes_zh = extract_unreleased("CHANGELOG_zh.md")
124+
public_notes_en = public_release_notes(notes_en)
125+
abort("Empty public release notes after filtering internal changelog sections") if public_notes_en.empty?
108126
109127
archive_unreleased("CHANGELOG.md", "## [#{version}] - #{date}", notes_en)
110128
archive_unreleased("CHANGELOG_zh.md", "## [#{version}]", notes_zh)
@@ -114,7 +132,7 @@ jobs:
114132
Prepare release `v#{version}`.
115133
116134
## Release Notes
117-
#{notes_en}
135+
#{public_notes_en}
118136
BODY
119137
120138
File.write("build/release-pr-body.md", body)

.github/workflows/release.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,30 @@ jobs:
6565
6666
version = ARGV.fetch(0)
6767
output = ARGV.fetch(1)
68+
excluded_headings = ["### 🔧 CI/CD"]
69+
70+
def public_release_notes(markdown, excluded_headings)
71+
skip_section = false
72+
markdown.each_line.each_with_object([]) do |line, lines|
73+
stripped = line.strip
74+
if stripped.start_with?("### ")
75+
skip_section = excluded_headings.include?(stripped)
76+
next if skip_section
77+
elsif stripped.start_with?("## ")
78+
skip_section = false
79+
end
80+
81+
lines << line unless skip_section
82+
end.join.strip
83+
end
84+
6885
changelog = File.read("CHANGELOG.md")
6986
pattern = /^## \[#{Regexp.escape(version)}\](?: - \d{4}-\d{2}-\d{2})?\s*$\n(?<body>.*?)(?=^## \[|\z)/m
7087
match = changelog.match(pattern)
7188
abort("Missing CHANGELOG.md section for #{version}") unless match
7289
73-
body = match[:body].strip
74-
abort("Empty CHANGELOG.md section for #{version}") if body.empty?
90+
body = public_release_notes(match[:body], excluded_headings)
91+
abort("Empty public release notes for #{version} after filtering internal changelog sections") if body.empty?
7592
7693
FileUtils.mkdir_p(File.dirname(output))
7794
File.write(output, body + "\n")

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Updated the bundled Mermaid runtime to [mermaid@11.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0).
1111

1212
### 🔧 CI/CD
13+
- Filtered internal CI/CD entries out of public release notes and JetBrains Marketplace change notes.
1314
- Configured release automation commits and tags with GitHub-attributed author and collaborator metadata.
1415
- Enforced Unreleased-only bilingual changelog updates and duplicate section checks in CI.
1516
- Added upstream release links, automated PR labels, and co-author metadata to Mermaid runtime sync automation.

CHANGELOG_zh.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- 将内置 Mermaid runtime 更新到 [mermaid@11.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0)
1111

1212
### 🔧 CI/CD
13+
- 从公开 release notes 和 JetBrains Marketplace change notes 中过滤内部 CI/CD 条目。
1314
- 为 release 自动化提交和 tag 配置可归属的 GitHub 作者与协作者元数据。
1415
- 在 CI 中强制双语 changelog 只能更新 Unreleased,并检查重复小节。
1516
- 为 Mermaid runtime 同步自动化新增上游 release 链接、自动 PR labels 和 co-author 元数据。

build.gradle.kts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,29 @@ dependencies {
4646
}
4747
}
4848

49+
val publicReleaseNoteExcludedHeadings = setOf("### 🔧 CI/CD")
50+
51+
fun publicReleaseNotes(markdown: String): String {
52+
var skipSection = false
53+
return markdown
54+
.lineSequence()
55+
.filter { line ->
56+
when {
57+
line.startsWith("### ") -> {
58+
skipSection = line.trim() in publicReleaseNoteExcludedHeadings
59+
!skipSection
60+
}
61+
line.startsWith("## ") -> {
62+
skipSection = false
63+
true
64+
}
65+
else -> !skipSection
66+
}
67+
}
68+
.joinToString("\n")
69+
.trim()
70+
}
71+
4972
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
5073
intellijPlatform {
5174
pluginConfiguration {
@@ -71,12 +94,13 @@ intellijPlatform {
7194
// Get the latest available change notes from the changelog file
7295
changeNotes = version.map { pluginVersion ->
7396
with(changelog) {
74-
renderItem(
97+
val releaseNotes = renderItem(
7598
(getOrNull(pluginVersion) ?: getUnreleased())
7699
.withHeader(false)
77100
.withEmptySections(false),
78-
Changelog.OutputType.HTML,
101+
Changelog.OutputType.MARKDOWN,
79102
)
103+
markdownToHTML(publicReleaseNotes(releaseNotes))
80104
}
81105
}
82106
}

0 commit comments

Comments
 (0)