plyght's own C++ browser for macOS
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

up

plyght 8acadf9d 08544c74

+85 -4
+85 -4
.github/workflows/release.yml
··· 23 23 outputs: 24 24 should_release: ${{ steps.check.outputs.should_release }} 25 25 version: ${{ steps.check.outputs.version }} 26 + prev_tag: ${{ steps.check.outputs.prev_tag }} 26 27 steps: 27 28 - name: Checkout code 28 29 uses: actions/checkout@v4 ··· 39 40 PREV_VERSION=$(grep -E '^project\(pocb VERSION ' /tmp/old_CMakeLists.txt | sed -E 's/.*VERSION ([^ )]+).*/\1/') 40 41 echo "Previous version: $PREV_VERSION" 41 42 43 + PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") 44 + echo "Previous tag: $PREV_TAG" 45 + echo "prev_tag=$PREV_TAG" >> $GITHUB_OUTPUT 46 + 42 47 if git ls-remote --tags origin | grep -q "refs/tags/v$CURRENT_VERSION"; then 43 48 echo "Tag v$CURRENT_VERSION already exists, skipping release" 44 49 echo "should_release=false" >> $GITHUB_OUTPUT ··· 51 56 echo "should_release=false" >> $GITHUB_OUTPUT 52 57 fi 53 58 59 + generate-notes: 60 + name: Generate AI release notes 61 + runs-on: ubuntu-latest 62 + needs: check-version 63 + if: needs.check-version.outputs.should_release == 'true' 64 + outputs: 65 + release_notes: ${{ steps.generate.outputs.notes }} 66 + steps: 67 + - name: Checkout code 68 + uses: actions/checkout@v4 69 + with: 70 + fetch-depth: 0 71 + 72 + - name: Generate release notes from code diff 73 + id: generate 74 + env: 75 + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} 76 + run: | 77 + VERSION="${{ needs.check-version.outputs.version }}" 78 + PREV_TAG="${{ needs.check-version.outputs.prev_tag }}" 79 + 80 + if [ -n "$PREV_TAG" ]; then 81 + echo "Getting diff from $PREV_TAG to HEAD" 82 + DIFF=$(git diff "$PREV_TAG"..HEAD -- '*.cpp' '*.h' '*.hpp' '*.m' '*.mm' '*.ui' '*.qrc' 'CMakeLists.txt' 2>/dev/null || echo "No diff available") 83 + else 84 + echo "No previous tag, getting diff from initial commit" 85 + FIRST_COMMIT=$(git rev-list --max-parents=0 HEAD) 86 + DIFF=$(git diff "$FIRST_COMMIT"..HEAD -- '*.cpp' '*.h' '*.hpp' '*.m' '*.mm' '*.ui' '*.qrc' 'CMakeLists.txt' 2>/dev/null || echo "No diff available") 87 + fi 88 + 89 + DIFF_LENGTH=${#DIFF} 90 + if [ $DIFF_LENGTH -gt 80000 ]; then 91 + DIFF="${DIFF:0:80000}... [truncated]" 92 + fi 93 + 94 + REQUEST=$(jq -n \ 95 + --arg diff "Generate release notes for version $VERSION of pocb (a macOS Qt/C++ app distributed as a DMG).\n\nCode diff:\n$DIFF" \ 96 + '{ 97 + "model": "gpt-5.5", 98 + "messages": [ 99 + { 100 + "role": "system", 101 + "content": "You generate release notes from code diffs. Rules:\n- No emojis\n- No title/header (release name already shown in GitHub UI)\n- Minimal, concise, yet comprehensive\n- Only include sections with actual changes (omit empty sections entirely)\n- Use markdown ## headers: Features, Fixes, Improvements, Breaking Changes\n- Focus on user-facing changes only, skip internal refactoring\n- If only version bump with no real changes, output exactly: Maintenance release." 102 + }, 103 + { 104 + "role": "user", 105 + "content": $diff 106 + } 107 + ], 108 + "max_completion_tokens": 2000 109 + }') 110 + 111 + RESPONSE=$(curl -s https://api.openai.com/v1/chat/completions \ 112 + -H "Content-Type: application/json" \ 113 + -H "Authorization: Bearer $OPENAI_API_KEY" \ 114 + -d "$REQUEST") 115 + 116 + NOTES=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // empty') 117 + 118 + if [ -z "$NOTES" ]; then 119 + echo "API call failed or empty response, using fallback" 120 + if [ -n "$PREV_TAG" ]; then 121 + NOTES="## What's Changed 122 + See the [full changelog](https://github.com/${{ github.repository }}/compare/${PREV_TAG}...v${VERSION}) for details." 123 + else 124 + NOTES="## Release v${VERSION} 125 + Initial release." 126 + fi 127 + fi 128 + 129 + echo "$NOTES" > /tmp/release_notes.md 130 + 131 + echo "notes<<NOTES_EOF" >> $GITHUB_OUTPUT 132 + cat /tmp/release_notes.md >> $GITHUB_OUTPUT 133 + echo "NOTES_EOF" >> $GITHUB_OUTPUT 134 + 54 135 create-tag: 55 136 name: Create release tag 56 137 runs-on: ubuntu-latest 57 - needs: check-version 138 + needs: [check-version, generate-notes] 58 139 if: needs.check-version.outputs.should_release == 'true' 59 140 steps: 60 141 - name: Checkout code ··· 70 151 create-release: 71 152 name: Create GitHub release 72 153 runs-on: ubuntu-latest 73 - needs: [check-version, create-tag] 154 + needs: [check-version, generate-notes, create-tag] 74 155 if: needs.check-version.outputs.should_release == 'true' 75 156 steps: 76 - - name: Create release 157 + - name: Create release with AI notes 77 158 uses: softprops/action-gh-release@v2 78 159 with: 79 160 tag_name: v${{ needs.check-version.outputs.version }} 80 161 name: v${{ needs.check-version.outputs.version }} 81 - body: macOS DMG build for pocb. 162 + body: ${{ needs.generate-notes.outputs.release_notes }} 82 163 draft: false 83 164 prerelease: false 84 165 env: