Improve Release Notes (#394)

* update ai release notes job - increase gradle memory limit
This commit is contained in:
Violet Caulfield
2025-06-01 08:53:48 -05:00
committed by GitHub
parent 71c0000b57
commit 92c4efb082
2 changed files with 69 additions and 35 deletions

View File

@@ -24,6 +24,71 @@ on:
- major
jobs:
generate-release-notes:
runs-on: ubuntu-latest
outputs:
release_notes: ${{ steps.ai_release_notes.outputs.release_notes }}
steps:
- name: 🛒 Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.SIGNING_REPO_PAT }}
- name: 🧠 Collect commit messages
id: commits
run: |
git fetch --quiet origin main
# Find common ancestor between HEAD and origin/main
BASE_SHA=$(git merge-base origin/main HEAD)
# Get all non-merge commit messages since that base
COMMIT_MESSAGES=$(git log --no-merges --pretty=format:"- %s" "${BASE_SHA}..HEAD")
# Print them to the GitHub Actions output
{
echo "messages<<EOF"
echo "$COMMIT_MESSAGES"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: ✨ Generate release notes with ChatGPT
id: ai_release_notes
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
MESSAGES=$(cat <<EOF
${{ steps.commits.outputs.messages }}
EOF
)
JSON=$(jq -n \
--arg commits "$MESSAGES" \
'{
model: "gpt-4o",
temperature: 0.7,
messages: [
{"role": "system", "content": "You are a React Native developer named Violet that is writing concise and friendly mobile app release notes from commit messages."},
{"role": "system", "content": "You are writing release notes for a mobile app called Jellify. The app is a music player that allows you to play music from your Jellyfin media server and stream music from the internet."},
{"role": "system", "content": "You are a music enthusiast and you love music related puns and jokes. You can lightly add a pun or joke to the release notes if it's relevant to the release."},
{"role": "system", "content": "Release notes should be concise and helpful to any user of the app - regardless of their technical knowledge."},
{"role": "system", "content": "Release notes should be written in a way that is easy to understand and follow, and engaging and entertaining to read."},
{"role": "user", "content": "Write a release summary based on these commit messages:\n\($commits)"}
]
}')
RESPONSE=$(curl -s https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d "$JSON")
RELEASE_BODY=$(echo "$RESPONSE" | jq -r '.choices[0].message.content')
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
echo "$RELEASE_BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
publish-android:
if: ${{ github.event.inputs['build-platform'] == 'Android' || github.event.inputs['build-platform'] == 'Both' }}
runs-on: ubuntu-latest
@@ -95,6 +160,7 @@ jobs:
runs-on: macos-15
outputs:
version: ${{ steps.setver.outputs.version }}
needs: [generate-release-notes]
steps:
- name: 🛒 Checkout
@@ -106,8 +172,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
- name: 🍎 Run yarn init-ios:new-arch
run: yarn init-ios:new-arch
@@ -161,7 +225,7 @@ jobs:
path: ./ios/Jellify.ipa
finalize-release:
needs: [publish-android, publish-ios]
needs: [publish-android, publish-iOS, generate-release-notes]
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout Repo
@@ -216,36 +280,6 @@ jobs:
git pull origin main
git push origin main
- name: 🧠 Get commit messages for this release
id: commits
run: |
echo "messages<<EOF" >> $GITHUB_OUTPUT
git log --pretty=format:"- %s" $(git describe --tags --abbrev=0)..HEAD >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: ✨ Generate Release Notes with ChatGPT
id: ai_release_notes
run: |
RELEASE_BODY=$(curl -s https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{"role": "system", "content": "You are a helpful assistant that writes concise and friendly mobile app release notes from commit messages."},
{"role": "system", "content": "You are writing release notes for a mobile app called Jellify. The app is a music player that allows you to play music from your library and stream music from the internet."},
{"role": "system", "content": "You are a music enthusiast and you love music related puns and jokes. You can lightly add a pun or joke to the release notes if it's relevant to the release."},
{"role": "system", "content": "Release notes should be concise and helpful to any user of the app - regardless of their technical knowledge."},
{"role": "system", "content": "Release notes should be written in a way that is easy to understand and follow."},
{"role": "user", "content": "Write a release summary based on these commit messages:\n'"${{ steps.commits.outputs.messages }}"'"}
],
"temperature": 0.7
}' | jq -r '.choices[0].message.content')
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
echo "$RELEASE_BODY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: 🎉 Create Unified GitHub Release
uses: ncipollo/release-action@v1
id: githubRelease
@@ -253,7 +287,7 @@ jobs:
artifacts: ./final-artifacts/*
name: ${{ needs.publish-ios.outputs.version || needs.publish-android.outputs.version }}
tag: ${{ needs.publish-ios.outputs.version || needs.publish-android.outputs.version }}
body: ${{ steps.ai_release_notes.outputs.release_notes }}
body: ${{ needs.generate-release-notes.outputs.release_notes }}
prerelease: true
token: ${{ secrets.SIGNING_REPO_PAT }}

View File

@@ -10,7 +10,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m
org.gradle.jvmargs=-Xmx8192m -XX:MaxMetaspaceSize=512m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit