Skip to content

Commit 33760c3

Browse files
committed
Use release_notes when publishing GH release
1 parent f3e16ff commit 33760c3

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ jobs:
152152
rm target/skija-linux-*-javadoc.jar
153153
rm target/skija-windows-*-sources.jar
154154
rm target/skija-windows-*-javadoc.jar
155-
- uses: softprops/action-gh-release@v1
155+
- uses: softprops/action-gh-release@v2
156156
with:
157+
body_path: RELEASE_NOTES.md
157158
files: |
158159
target/*.jmod
159160
target/*.jar

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ __pycache__
1010

1111
/.idea
1212
*.iml
13+
RELEASE_NOTES.md

script/build_utils.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,35 @@ def parse_sha() -> str:
2929
if sha:
3030
return sha[:10]
3131

32+
def release_notes(version: str):
33+
with open('CHANGELOG.md', 'r') as f:
34+
lines = f.readlines()
35+
36+
# Find the header that starts with "# {version}"
37+
start_idx = None
38+
for i, line in enumerate(lines):
39+
if line.startswith(f'# {version}'):
40+
start_idx = i
41+
break
42+
43+
if start_idx is None:
44+
raise Exception(f"Version {version} not found in CHANGELOG.md")
45+
46+
# Extract lines after the header until the next header (line starting with #) or end of file
47+
content_lines = []
48+
for i in range(start_idx + 1, len(lines)):
49+
line = lines[i]
50+
if line.startswith('#'):
51+
break
52+
content_lines.append(line)
53+
54+
# Write to RELEASE_NOTES.md
55+
content = ''.join(content_lines).strip() + '\n'
56+
with open('RELEASE_NOTES.md', 'w') as f:
57+
f.write(content)
58+
59+
print(f"Wrote release notes for {version} to RELEASE_NOTES.md", flush=True)
60+
3261
def makedirs(path):
3362
os.makedirs(path, exist_ok=True)
3463

script/release.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
def main():
55
os.chdir(common.basedir)
66

7+
build_utils.release_notes(common.version)
8+
79
for name in ['skija-shared', 'skija-windows-x64', 'skija-linux-x64', 'skija-macos-x64', 'skija-macos-arm64']: # 'linux-arm64'
810
jars = [f"target/{name}-{common.version}{classifier}.jar" for classifier in ["", "-sources", "-javadoc"]]
911
build_utils.collect_jars('io.github.humbleui', name, common.version, jars, 'target/release')

0 commit comments

Comments
 (0)