Skip to content

Commit d512b25

Browse files
fix(ci): improve release workflow
1. Fix tag format - use existing format without 'v' prefix (1.0.5 not v1.0.5) 2. Fix bot email to use GitHub's format so app avatar shows on commits 3. Update README sections with full changelog content, not just version number Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net>
1 parent 0bda93f commit d512b25

1 file changed

Lines changed: 56 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ jobs:
151151
CURRENT_CORE=$(jq -r '.version' UnityProject/Packages/com.jasonxudeveloper.jengine.core/package.json)
152152
153153
# Always use Core version for changelog base (releases follow Core version)
154-
BASE_TAG="v$CURRENT_CORE"
154+
# Note: existing tags don't have 'v' prefix (e.g., 1.0.5 not v1.0.5)
155+
BASE_TAG="$CURRENT_CORE"
155156
156157
echo "base_tag=$BASE_TAG" >> $GITHUB_OUTPUT
157158
echo "Using base tag for changelog: $BASE_TAG"
@@ -305,18 +306,59 @@ jobs:
305306
- name: Update README.md
306307
if: inputs.release_core == true
307308
run: |
308-
VERSION="${{ needs.validate.outputs.release_tag }}"
309-
VERSION="${VERSION#v}" # Remove 'v' prefix
310-
sed -i "s/^## 🎉 Latest Features (v[0-9.]*)/## 🎉 Latest Features (v$VERSION)/" README.md
311-
echo "✅ Updated README.md version reference"
309+
VERSION="${{ needs.validate.outputs.core_version }}"
310+
CHANGELOG=$(cat /tmp/changelog.txt)
311+
312+
# Extract feature bullet points from changelog for README
313+
FEATURES=""
314+
if echo "$CHANGELOG" | grep -q "### ✨ Features"; then
315+
FEATURES=$(echo "$CHANGELOG" | sed -n '/### ✨ Features/,/###/p' | grep "^- " || true)
316+
fi
317+
if echo "$CHANGELOG" | grep -q "### 🐛 Bug Fixes"; then
318+
FIXES=$(echo "$CHANGELOG" | sed -n '/### 🐛 Bug Fixes/,/###/p' | grep "^- " || true)
319+
FEATURES="${FEATURES}"$'\n'"${FIXES}"
320+
fi
321+
322+
# If no features/fixes, use a generic message
323+
if [ -z "$FEATURES" ]; then
324+
FEATURES="- Minor updates and improvements"
325+
fi
326+
327+
# Create the new Latest Features section
328+
NEW_SECTION="## 🎉 Latest Features (v$VERSION)"$'\n'$'\n'"$FEATURES"$'\n'$'\n'"[📋 View Complete Changelog](CHANGE.md)"
329+
330+
# Replace the entire Latest Features section in README.md
331+
# Match from "## 🎉 Latest Features" to just before "## 📊 Project Statistics"
332+
sed -i '/^## 🎉 Latest Features/,/^\[📋 View Complete Changelog\]/c\'"$NEW_SECTION" README.md
333+
echo "✅ Updated README.md with new features"
312334
313335
- name: Update README_zh_cn.md
314336
if: inputs.release_core == true
315337
run: |
316-
VERSION="${{ needs.validate.outputs.release_tag }}"
317-
VERSION="${VERSION#v}" # Remove 'v' prefix
318-
sed -i "s/^## 🎉 最新功能 (v[0-9.]*)/## 🎉 最新功能 (v$VERSION)/" README_zh_cn.md
319-
echo "✅ Updated README_zh_cn.md version reference"
338+
VERSION="${{ needs.validate.outputs.core_version }}"
339+
CHANGELOG=$(cat /tmp/changelog.txt)
340+
341+
# Extract feature bullet points from changelog for README
342+
FEATURES=""
343+
if echo "$CHANGELOG" | grep -q "### ✨ Features"; then
344+
FEATURES=$(echo "$CHANGELOG" | sed -n '/### ✨ Features/,/###/p' | grep "^- " || true)
345+
fi
346+
if echo "$CHANGELOG" | grep -q "### 🐛 Bug Fixes"; then
347+
FIXES=$(echo "$CHANGELOG" | sed -n '/### 🐛 Bug Fixes/,/###/p' | grep "^- " || true)
348+
FEATURES="${FEATURES}"$'\n'"${FIXES}"
349+
fi
350+
351+
# If no features/fixes, use a generic message
352+
if [ -z "$FEATURES" ]; then
353+
FEATURES="- 小更新和改进"
354+
fi
355+
356+
# Create the new Latest Features section (Chinese)
357+
NEW_SECTION="## 🎉 最新功能 (v$VERSION)"$'\n'$'\n'"$FEATURES"$'\n'$'\n'"[📋 查看完整更新日志](CHANGE.md)"
358+
359+
# Replace the entire Latest Features section in README_zh_cn.md
360+
sed -i '/^## 🎉 最新功能/,/^\[📋 查看完整更新日志\]/c\'"$NEW_SECTION" README_zh_cn.md
361+
echo "✅ Updated README_zh_cn.md with new features"
320362
321363
# Update CHANGE.md
322364
- name: Update CHANGE.md
@@ -387,9 +429,12 @@ jobs:
387429
388430
# Commit and push changes
389431
- name: Commit and push changes
432+
env:
433+
APP_ID: ${{ secrets.RELEASE_APP_ID }}
390434
run: |
391-
git config user.name "JEngine Release Bot[bot]"
392-
git config user.email "release-bot[bot]@jengine.xgamedev.net"
435+
# Use GitHub's bot email format so the app avatar shows on commits
436+
git config user.name "jengine-release-bot[bot]"
437+
git config user.email "${APP_ID}+jengine-release-bot[bot]@users.noreply.github.com"
393438
394439
git add UnityProject/Packages/*/package.json README*.md CHANGE.md
395440

0 commit comments

Comments
 (0)