ci(workflows): use release action and simplify notes
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 18s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Has been skipped
Multi-Platform CI / Package for Windows x86_64 (push) Has been skipped
Multi-Platform CI / Create GitHub Release (push) Has been skipped
Multi-Platform CI / test-platforms (ubuntu-22.04) (push) Successful in 18s
Multi-Platform CI / test-platforms (windows-latest) (push) Successful in 18s
Multi-Platform CI / Package for Linux x86_64 (push) Has been skipped
Multi-Platform CI / Package for Windows x86_64 (push) Has been skipped
Multi-Platform CI / Create GitHub Release (push) Has been skipped
- Drop GPT-based release notes; generate from git log into release_notes.md - Remove OPENAI_API_KEY requirement - Replace curl-based release creation and asset uploads with akkuman/gitea-release-action@v1 (uses body_path and files) - Add NODE_OPTIONS=--experimental-fetch for the action This reduces complexity, removes an external dependency, and makes releases more deterministic and maintainable.
This commit is contained in:
@@ -83,10 +83,7 @@ jobs:
|
||||
echo "last_tag=$LAST_TAG" >> $GITHUB_OUTPUT
|
||||
echo "Last tag/commit: $LAST_TAG"
|
||||
|
||||
- name: Generate release notes with GPT-5
|
||||
id: release_notes
|
||||
env:
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
- name: Generate release notes
|
||||
run: |
|
||||
# Get git log since last release
|
||||
if [ -n "${{ steps.last_tag.outputs.last_tag }}" ]; then
|
||||
@@ -95,40 +92,19 @@ jobs:
|
||||
GIT_LOG=$(git log --pretty=format:"- %s (%an)" HEAD~10..HEAD)
|
||||
fi
|
||||
|
||||
# Create a temporary file for the API request
|
||||
cat > request.json << EOF
|
||||
{
|
||||
"model": "gpt-4o",
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "You are a technical writer creating GitHub release notes. Generate professional, concise release notes based on git commit history. Focus on user-facing changes and improvements. Use proper markdown formatting with sections like ## What's New, ## Improvements, ## Bug Fixes, etc. Keep it under 500 words."
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Generate release notes for version ${{ steps.version.outputs.version }} based on these commits:\\n\\n$GIT_LOG"
|
||||
}
|
||||
],
|
||||
"max_tokens": 1000,
|
||||
"temperature": 0.3
|
||||
}
|
||||
# Generate simple release notes
|
||||
cat > release_notes.md << EOF
|
||||
## Release ${{ steps.version.outputs.version }}
|
||||
|
||||
### Changes
|
||||
$GIT_LOG
|
||||
|
||||
---
|
||||
*Generated automatically from commit history*
|
||||
EOF
|
||||
|
||||
# Make API request to OpenAI
|
||||
RESPONSE=$(curl -s -X POST "https://api.openai.com/v1/chat/completions" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||
-d @request.json)
|
||||
|
||||
# Extract the content and save to file
|
||||
echo "$RESPONSE" | jq -r '.choices[0].message.content' > release_notes.md
|
||||
|
||||
# Set output for use in release creation
|
||||
{
|
||||
echo 'notes<<EOF'
|
||||
cat release_notes.md
|
||||
echo 'EOF'
|
||||
} >> $GITHUB_OUTPUT
|
||||
echo "Generated release notes:"
|
||||
cat release_notes.md
|
||||
|
||||
- name: Prepare release assets
|
||||
run: |
|
||||
@@ -138,35 +114,14 @@ jobs:
|
||||
done
|
||||
ls -la release_assets/
|
||||
|
||||
- name: Create Gitea Release
|
||||
run: |
|
||||
# Create the release using Gitea API
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"tag_name": "${{ steps.version.outputs.version }}",
|
||||
"name": "Release ${{ steps.version.outputs.version }}",
|
||||
"body": "'"$(cat release_notes.md | sed 's/"/\\"/g' | tr '\n' '\\n')"'",
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}' \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
|
||||
|
||||
- name: Upload release assets
|
||||
run: |
|
||||
# Get the release ID from the created release
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/${{ steps.version.outputs.version }}" | \
|
||||
jq -r '.id')
|
||||
|
||||
# Upload each asset
|
||||
for file in release_assets/*; do
|
||||
filename=$(basename "$file")
|
||||
echo "Uploading $filename..."
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"$file" \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets?name=$filename"
|
||||
done
|
||||
- name: Create GitHub Release with Assets
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
env:
|
||||
NODE_OPTIONS: '--experimental-fetch'
|
||||
with:
|
||||
server_url: ${{ github.server_url }}
|
||||
token: ${{ secrets.RELEASE_TOKEN }}
|
||||
tag_name: ${{ steps.version.outputs.version }}
|
||||
body_path: release_notes.md
|
||||
files: |-
|
||||
release_assets/**
|
||||
Reference in New Issue
Block a user