feat: implement release notes generation with categorized changes since last tag
This commit is contained in:
parent
1b059c35f1
commit
deb7abd102
35
.github/workflows/gitea-release.yml
vendored
35
.github/workflows/gitea-release.yml
vendored
@ -66,14 +66,33 @@ jobs:
|
||||
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Read CHANGELOG.md
|
||||
id: changelog
|
||||
- name: Generate Release Notes
|
||||
id: release_notes
|
||||
run: |
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
CHANGELOG=$(awk "/## \\[$VERSION\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
|
||||
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$LAST_TAG" ]; then
|
||||
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "Changes since $LAST_TAG:" >> $GITHUB_OUTPUT
|
||||
echo "" >> $GITHUB_OUTPUT
|
||||
|
||||
# Get commits since last tag and categorize them
|
||||
echo "### Added" >> $GITHUB_OUTPUT
|
||||
git log $LAST_TAG..HEAD --pretty=format:%s | grep -iE '^(feat|add|new)' | sed 's/^feat: /- /' >> $GITHUB_OUTPUT || true
|
||||
echo "" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "### Fixed" >> $GITHUB_OUTPUT
|
||||
git log $LAST_TAG..HEAD --pretty=format:%s | grep -iE '^fix' | sed 's/^fix: /- /' >> $GITHUB_OUTPUT || true
|
||||
echo "" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "### Changed" >> $GITHUB_OUTPUT
|
||||
git log $LAST_TAG..HEAD --pretty=format:%s | grep -ivE '^(feat|fix|add|new)' | sed 's/^/- /' >> $GITHUB_OUTPUT || true
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "Initial Release" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Determine Gitea URL
|
||||
id: gitea_url
|
||||
@ -122,7 +141,7 @@ jobs:
|
||||
|
||||
# Erstelle zuerst den Release ohne Dateien
|
||||
echo "Debug: Creating release..."
|
||||
RELEASE_DATA="{\"tag_name\":\"v${VERSION}\",\"name\":\"v${VERSION}\",\"body\":\"${{ steps.changelog.outputs.CHANGES }}\"}"
|
||||
RELEASE_DATA="{\"tag_name\":\"v${VERSION}\",\"name\":\"v${VERSION}\",\"body\":\"${{ steps.release_notes.outputs.CHANGES }}\"}"
|
||||
|
||||
RELEASE_RESPONSE=$(curl -s -w "\n%{http_code}" \
|
||||
-X POST \
|
||||
|
35
.github/workflows/github-release.yml
vendored
35
.github/workflows/github-release.yml
vendored
@ -73,14 +73,33 @@ jobs:
|
||||
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
|
||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Read CHANGELOG.md
|
||||
id: changelog
|
||||
- name: Generate Release Notes
|
||||
id: release_notes
|
||||
run: |
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
CHANGELOG=$(awk "/## \\[$VERSION\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
|
||||
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
||||
|
||||
if [ -n "$LAST_TAG" ]; then
|
||||
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "Changes since $LAST_TAG:" >> $GITHUB_OUTPUT
|
||||
echo "" >> $GITHUB_OUTPUT
|
||||
|
||||
# Get commits since last tag and categorize them
|
||||
echo "### Added" >> $GITHUB_OUTPUT
|
||||
git log $LAST_TAG..HEAD --pretty=format:%s | grep -iE '^(feat|add|new)' | sed 's/^feat: /- /' >> $GITHUB_OUTPUT || true
|
||||
echo "" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "### Fixed" >> $GITHUB_OUTPUT
|
||||
git log $LAST_TAG..HEAD --pretty=format:%s | grep -iE '^fix' | sed 's/^fix: /- /' >> $GITHUB_OUTPUT || true
|
||||
echo "" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "### Changed" >> $GITHUB_OUTPUT
|
||||
git log $LAST_TAG..HEAD --pretty=format:%s | grep -ivE '^(feat|fix|add|new)' | sed 's/^/- /' >> $GITHUB_OUTPUT || true
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "Initial Release" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Create GitHub Release
|
||||
env:
|
||||
@ -110,7 +129,7 @@ jobs:
|
||||
if [ -n "$FILES_TO_UPLOAD" ]; then
|
||||
gh release create "v${VERSION}" \
|
||||
--title "Release ${VERSION}" \
|
||||
--notes "${{ steps.changelog.outputs.CHANGES }}" \
|
||||
--notes "${{ steps.release_notes.outputs.CHANGES }}" \
|
||||
$FILES_TO_UPLOAD
|
||||
else
|
||||
echo "Error: No files found to upload"
|
||||
|
Loading…
x
Reference in New Issue
Block a user