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=$LAST_TAG" >> $GITHUB_OUTPUT
|
||||||
echo "Last tag/commit: $LAST_TAG"
|
echo "Last tag/commit: $LAST_TAG"
|
||||||
|
|
||||||
- name: Generate release notes with GPT-5
|
- name: Generate release notes
|
||||||
id: release_notes
|
|
||||||
env:
|
|
||||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
||||||
run: |
|
run: |
|
||||||
# Get git log since last release
|
# Get git log since last release
|
||||||
if [ -n "${{ steps.last_tag.outputs.last_tag }}" ]; then
|
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)
|
GIT_LOG=$(git log --pretty=format:"- %s (%an)" HEAD~10..HEAD)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a temporary file for the API request
|
# Generate simple release notes
|
||||||
cat > request.json << EOF
|
cat > release_notes.md << EOF
|
||||||
{
|
## Release ${{ steps.version.outputs.version }}
|
||||||
"model": "gpt-4o",
|
|
||||||
"messages": [
|
### Changes
|
||||||
{
|
$GIT_LOG
|
||||||
"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."
|
---
|
||||||
},
|
*Generated automatically from commit history*
|
||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Make API request to OpenAI
|
echo "Generated release notes:"
|
||||||
RESPONSE=$(curl -s -X POST "https://api.openai.com/v1/chat/completions" \
|
cat release_notes.md
|
||||||
-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
|
|
||||||
|
|
||||||
- name: Prepare release assets
|
- name: Prepare release assets
|
||||||
run: |
|
run: |
|
||||||
@@ -138,35 +114,14 @@ jobs:
|
|||||||
done
|
done
|
||||||
ls -la release_assets/
|
ls -la release_assets/
|
||||||
|
|
||||||
- name: Create Gitea Release
|
- name: Create GitHub Release with Assets
|
||||||
run: |
|
uses: akkuman/gitea-release-action@v1
|
||||||
# Create the release using Gitea API
|
env:
|
||||||
curl -X POST \
|
NODE_OPTIONS: '--experimental-fetch'
|
||||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
with:
|
||||||
-H "Content-Type: application/json" \
|
server_url: ${{ github.server_url }}
|
||||||
-d '{
|
token: ${{ secrets.RELEASE_TOKEN }}
|
||||||
"tag_name": "${{ steps.version.outputs.version }}",
|
tag_name: ${{ steps.version.outputs.version }}
|
||||||
"name": "Release ${{ steps.version.outputs.version }}",
|
body_path: release_notes.md
|
||||||
"body": "'"$(cat release_notes.md | sed 's/"/\\"/g' | tr '\n' '\\n')"'",
|
files: |-
|
||||||
"draft": false,
|
release_assets/**
|
||||||
"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
|
|
||||||
Reference in New Issue
Block a user