Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/generate_release_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import re

def main() -> None:
"""Generate release notes for the latest GitHub release."""

with open("CHANGELOG.md", encoding="utf-8") as file:
changelog = file.read()

first_section = re.search(r"^### ", changelog, re.MULTILINE)
if first_section is None:
raise RuntimeError("Could not find the first changelog section.")

next_release = re.search(r"^## ", changelog[first_section.start():], re.MULTILINE)

if next_release is None:
raise RuntimeError("Could not find the next release heading.")

latest_changes = changelog[first_section.start() : first_section.start() + next_release.start()].strip()

release_notes = f"""A fast code formatter for GDScript in Godot 4.

## Changelog

{latest_changes}

Learn more about the formatter in the [GDScript Formatter documentation](https://www.gdquest.com/library/gdscript_formatter/)
"""

print(release_notes)

if __name__ == "__main__":
main()
13 changes: 4 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,12 @@ jobs:
path: artifacts
merge-multiple: true

- name: Generate release notes
run: python .github/generate_release_notes.py > release-notes.md

- name: Create Release
run: |
gh release create "${{ github.ref_name }}" \
--verify-tag \
--draft \
--title "GDScript formatter ${{ github.ref_name }}" \
--notes "A fast code formatter for GDScript in Godot 4.

You can learn how to install, use, configure, and integrate the formatter into your workflow on this page:

https://www.gdquest.com/library/gdscript_formatter/"
gh release create "${{ github.ref_name }}" --verify-tag --draft --title "GDScript formatter ${{ github.ref_name }}" --notes-file release-notes.md

gh release upload "${{ github.ref_name }}" artifacts/*.zip
gh release edit "${{ github.ref_name }}" --draft=false
Expand Down