diff --git a/.gitea/workflows/multi-platform.yml b/.gitea/workflows/multi-platform.yml index be14824..c1f316d 100644 --- a/.gitea/workflows/multi-platform.yml +++ b/.gitea/workflows/multi-platform.yml @@ -84,6 +84,8 @@ jobs: echo "Last tag/commit: $LAST_TAG" - name: Generate release notes + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} run: | # Get git log since last release if [ -n "${{ steps.last_tag.outputs.last_tag }}" ]; then @@ -92,8 +94,32 @@ jobs: GIT_LOG=$(git log --pretty=format:"- %s (%an)" HEAD~10..HEAD) fi - # Generate simple release notes - cat > release_notes.md << EOF + # Try to generate AI-powered release notes + if [ -n "$OPENAI_API_KEY" ]; then + echo "Generating AI release notes..." + + PROMPT="Generate professional release notes for version ${{ steps.version.outputs.version }} based on these git commits. Focus on user-facing changes and improvements. Use markdown formatting with sections like ## What's New, ## Improvements, ## Bug Fixes. Keep it concise and under 500 words. + + Commits: + $GIT_LOG" + + RESPONSE=$(curl -s -X POST "https://api.openai.com/v1/responses" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d "{ + \"model\": \"gpt-5\", + \"input\": $(echo "$PROMPT" | jq -Rs .) + }") + + # Check if the API call was successful and extract the response + if echo "$RESPONSE" | jq -e '.choices[0].text' > /dev/null 2>&1; then + echo "$RESPONSE" | jq -r '.choices[0].text' > release_notes.md + echo "Generated AI release notes successfully" + else + echo "AI generation failed, falling back to simple notes" + echo "API Response: $RESPONSE" + # Fallback to simple notes + cat > release_notes.md << EOF ## Release ${{ steps.version.outputs.version }} ### Changes @@ -102,8 +128,22 @@ jobs: --- *Generated automatically from commit history* EOF + fi + else + echo "No OpenAI API key provided, generating simple release notes" + # Fallback to simple notes + cat > release_notes.md << EOF + ## Release ${{ steps.version.outputs.version }} - echo "Generated release notes:" + ### Changes + $GIT_LOG + + --- + *Generated automatically from commit history* + EOF + fi + + echo "Final release notes:" cat release_notes.md - name: Prepare release assets