feat: generate release notes from git log
Check Source / check (push) Successful in 2s
Auto Release / build (push) Failing after 2m2s
Simple Test / test (push) Successful in 1s
Test Env / test (push) Successful in 1s

This commit is contained in:
test
2026-09-27 14:50:30 +08:00
parent fd2728fe42
commit fbdcca4089
+17 -27
View File
@@ -52,39 +52,29 @@ jobs:
ls -la target/*.jar
echo "Verification completed"
- name: Generate Release Notes
id: notes
run: |
echo "Generating release notes from commits..."
VERSION=$(grep "^version:" src/main/resources/plugin.yml | awk '{print $2}' | tr -d '\r\n ')
TAG="v$VERSION"
echo "tag=$TAG" >> $GITHUB_OUTPUT
# Get all commits since last tag
COMMITS=$(git log --format="- %s" $(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo HEAD~10)..HEAD 2>/dev/null || git log --format="- %s" -10)
# Format: include commit hash and date
FULL_LOG=$(git log --format="**%h** - %an (%ad)%n%s" --date=short $(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo HEAD~10)..HEAD 2>/dev/null || git log --format="**%h** - %an (%ad)%n%s" --date=short -10)
echo "## Changes" > /tmp/release_body.md
echo "" >> /tmp/release_body.md
echo "$FULL_LOG" >> /tmp/release_body.md
echo "" >> /tmp/release_body.md
echo "### Full Changelog" >> /tmp/release_body.md
echo "" >> /tmp/release_body.md
echo "\`$TAG\`" >> /tmp/release_body.md
echo "Release notes generated:"
cat /tmp/release_body.md
- name: Create Release
env:
GITEA_TOKEN: 2cb4826439e13d6f80776bf1e5832a88669856e2
run: |
set -e
TAG="${{ steps.notes.outputs.tag }}"
# Get version from plugin.yml
VERSION=$(grep "^version:" src/main/resources/plugin.yml | awk '{print $2}' | tr -d '\r\n ')
TAG="v$VERSION"
BASE="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY"
echo "Creating release for $TAG"
echo "Version: $VERSION, Tag: $TAG"
# Generate release notes from git log
echo "## Changes in $TAG" > /tmp/release_body.md
echo "" >> /tmp/release_body.md
git log --format="- **%h** %s (%an, %ad)" --date=short -10 >> /tmp/release_body.md
echo "" >> /tmp/release_body.md
echo "### Full changelog" >> /tmp/release_body.md
echo "" >> /tmp/release_body.md
echo "[View all commits](/youpaishidifu/Sdf1_login/commits/main)" >> /tmp/release_body.md
echo "=== Release notes ==="
cat /tmp/release_body.md
echo "===================="
echo "=== Checking existing tag $TAG ==="
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GITEA_TOKEN" "$BASE/releases/tags/$TAG")