Skip to content

Commit c6504df

Browse files
committed
Save release notes script
1 parent 82710c3 commit c6504df

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

scripts/generate-release-notes

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/sh -e
2+
3+
PROMPT="Your job is to write markdown release notes for a specific package version released from this monorepo. To do this, find the previous semver release for this same package, and evaluate all of the relevant changes since the previous version. Use the git commit messages and diffs to decide what to include in the release notes.
4+
5+
DO NOT include changes from other packages in this repo unless they are directly relevant to this package's release.
6+
7+
The release notes should include two sections.
8+
9+
The first is a \"What's changed\" section that should provide short summaries of changes that an end-user would care about (they likely don't care about internal refactors or changes that don't affect the public API or user experience). Where posssible, include the git commit hash where the change took place.
10+
11+
The second section is the \"Upgrade instructions\". This should also be a bulleted list of anything the user *needs* to do when upgrading from the previous version to this one. The upgrade instructions should be specific and actionable, so that a human or AI could read them and make the changes quickly and easily. If they don't *need* to do anything, then leave one instruction of \"No changes required\".
12+
13+
Example release notes:
14+
15+
---
16+
17+
### What's changed
18+
19+
- The \`testbrowser\` uses \`gunicorn\` relative to the running Python executable ([abc1234](https://github.com/dropseed/plain/commit/abc1234))
20+
- Trailing slashes are stripped automatically from \`plain tunnel DESTINATION\` ([def5678](https://github.com/dropseed/plain/commit/def5678))
21+
- The \`plainhtmx:load\` event has been removed in favor of \`load\` ([ghi9012](https://github.com/dropseed/plain/commit/ghi9012))
22+
23+
### Upgrade instructions
24+
25+
- Replace any usage of the \`plainhtmx:load\` event with the standard \`load\` event in your templates (ex. \`hx-trigger=\"plainhtmx:load from:body\"\` changes to \`hx-trigger=\"load from:body\"\`)
26+
27+
---
28+
29+
Write the release notes to the CHANGELOG.md file in the associated package (i.e. plain-admin/plain/admin/CHANGELOG.md). If the version isn't in the CHANGELOG yet, add it.
30+
31+
Once the CHANGELOG.md is updated and you are finished, simply output the release notes for this version, nothing else. This command will be piped to another command.
32+
33+
Generate release notes for this version (also the git tag):"
34+
35+
TAG="$1"
36+
if [ -z "$TAG" ]; then
37+
echo "Usage: $0 <tag>"
38+
exit 1
39+
fi
40+
41+
# Make sure the tag exists
42+
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
43+
echo "Tag '$TAG' does not exist."
44+
exit 1
45+
fi
46+
47+
NOTES=$(codex -m o3 --full-auto --no-project-doc -q "$PROMPT $TAG" | tee /dev/stderr | jq --raw-output --slurp '.[-1].content[0].text')
48+
49+
echo "\n\n"
50+
51+
echo "$NOTES"
52+
if [ -z "$NOTES" ]; then
53+
echo "No release notes generated. Exiting."
54+
exit 1
55+
fi
56+
57+
echo "\n\n"
58+
59+
# # Wait for the user to confirm the release notes
60+
# read -p "Do you want to create a release with these notes? (y/n): " confirm
61+
# if [ "$confirm" != "y" ]; then
62+
# echo "Release creation aborted."
63+
# exit 0
64+
# fi
65+
66+
gh release create "$TAG" --notes "$NOTES" --verify-tag --latest=false

0 commit comments

Comments
 (0)