Skip to content

Commit 0feaa40

Browse files
fix(ci): improve release workflow (#566)
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 Signed-off-by: JasonXuDeveloper - 傑 <jason@xgamedev.net> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0bda93f commit 0feaa40

File tree

1 file changed

+61
-14
lines changed

1 file changed

+61
-14
lines changed

.github/workflows/release.yml

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,13 @@ jobs:
105105
# Release tag always follows Core version
106106
# GitHub releases are only created when Core is released
107107
if [ "${{ inputs.release_core }}" == "true" ]; then
108-
echo "release_tag=v${{ inputs.core_version }}" >> $GITHUB_OUTPUT
108+
# No 'v' prefix to match existing tag format (1.0.5, not v1.0.5)
109+
echo "release_tag=${{ inputs.core_version }}" >> $GITHUB_OUTPUT
109110
echo "create_github_release=true" >> $GITHUB_OUTPUT
110111
else
111112
# If only Util is released, create tag for OpenUPM but no GitHub release
112-
echo "release_tag=util-v${{ inputs.util_version }}" >> $GITHUB_OUTPUT
113+
# No 'v' prefix to match existing tag format
114+
echo "release_tag=util-${{ inputs.util_version }}" >> $GITHUB_OUTPUT
113115
echo "create_github_release=false" >> $GITHUB_OUTPUT
114116
fi
115117
@@ -151,7 +153,8 @@ jobs:
151153
CURRENT_CORE=$(jq -r '.version' UnityProject/Packages/com.jasonxudeveloper.jengine.core/package.json)
152154
153155
# Always use Core version for changelog base (releases follow Core version)
154-
BASE_TAG="v$CURRENT_CORE"
156+
# Note: existing tags don't have 'v' prefix (e.g., 1.0.5 not v1.0.5)
157+
BASE_TAG="$CURRENT_CORE"
155158
156159
echo "base_tag=$BASE_TAG" >> $GITHUB_OUTPUT
157160
echo "Using base tag for changelog: $BASE_TAG"
@@ -305,18 +308,59 @@ jobs:
305308
- name: Update README.md
306309
if: inputs.release_core == true
307310
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"
311+
VERSION="${{ needs.validate.outputs.core_version }}"
312+
CHANGELOG=$(cat /tmp/changelog.txt)
313+
314+
# Extract feature bullet points from changelog for README
315+
FEATURES=""
316+
if echo "$CHANGELOG" | grep -q "### ✨ Features"; then
317+
FEATURES=$(echo "$CHANGELOG" | sed -n '/### ✨ Features/,/###/p' | grep "^- " || true)
318+
fi
319+
if echo "$CHANGELOG" | grep -q "### 🐛 Bug Fixes"; then
320+
FIXES=$(echo "$CHANGELOG" | sed -n '/### 🐛 Bug Fixes/,/###/p' | grep "^- " || true)
321+
FEATURES="${FEATURES}"$'\n'"${FIXES}"
322+
fi
323+
324+
# If no features/fixes, use a generic message
325+
if [ -z "$FEATURES" ]; then
326+
FEATURES="- Minor updates and improvements"
327+
fi
328+
329+
# Create the new Latest Features section
330+
NEW_SECTION="## 🎉 Latest Features (v$VERSION)"$'\n'$'\n'"$FEATURES"$'\n'$'\n'"[📋 View Complete Changelog](CHANGE.md)"
331+
332+
# Replace the entire Latest Features section in README.md
333+
# Match from "## 🎉 Latest Features" to just before "## 📊 Project Statistics"
334+
sed -i '/^## 🎉 Latest Features/,/^\[📋 View Complete Changelog\]/c\'"$NEW_SECTION" README.md
335+
echo "✅ Updated README.md with new features"
312336
313337
- name: Update README_zh_cn.md
314338
if: inputs.release_core == true
315339
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"
340+
VERSION="${{ needs.validate.outputs.core_version }}"
341+
CHANGELOG=$(cat /tmp/changelog.txt)
342+
343+
# Extract feature bullet points from changelog for README
344+
FEATURES=""
345+
if echo "$CHANGELOG" | grep -q "### ✨ Features"; then
346+
FEATURES=$(echo "$CHANGELOG" | sed -n '/### ✨ Features/,/###/p' | grep "^- " || true)
347+
fi
348+
if echo "$CHANGELOG" | grep -q "### 🐛 Bug Fixes"; then
349+
FIXES=$(echo "$CHANGELOG" | sed -n '/### 🐛 Bug Fixes/,/###/p' | grep "^- " || true)
350+
FEATURES="${FEATURES}"$'\n'"${FIXES}"
351+
fi
352+
353+
# If no features/fixes, use a generic message
354+
if [ -z "$FEATURES" ]; then
355+
FEATURES="- 小更新和改进"
356+
fi
357+
358+
# Create the new Latest Features section (Chinese)
359+
NEW_SECTION="## 🎉 最新功能 (v$VERSION)"$'\n'$'\n'"$FEATURES"$'\n'$'\n'"[📋 查看完整更新日志](CHANGE.md)"
360+
361+
# Replace the entire Latest Features section in README_zh_cn.md
362+
sed -i '/^## 🎉 最新功能/,/^\[📋 查看完整更新日志\]/c\'"$NEW_SECTION" README_zh_cn.md
363+
echo "✅ Updated README_zh_cn.md with new features"
320364
321365
# Update CHANGE.md
322366
- name: Update CHANGE.md
@@ -387,9 +431,12 @@ jobs:
387431
388432
# Commit and push changes
389433
- name: Commit and push changes
434+
env:
435+
APP_ID: ${{ secrets.RELEASE_APP_ID }}
390436
run: |
391-
git config user.name "JEngine Release Bot[bot]"
392-
git config user.email "release-bot[bot]@jengine.xgamedev.net"
437+
# Use GitHub's bot email format so the app avatar shows on commits
438+
git config user.name "jengine-release-bot[bot]"
439+
git config user.email "${APP_ID}+jengine-release-bot[bot]@users.noreply.github.com"
393440
394441
git add UnityProject/Packages/*/package.json README*.md CHANGE.md
395442
@@ -457,7 +504,7 @@ jobs:
457504
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
458505
with:
459506
tag_name: ${{ needs.validate.outputs.release_tag }}
460-
release_name: Release ${{ needs.validate.outputs.release_tag }}
507+
release_name: v${{ needs.validate.outputs.release_tag }}
461508
body: |
462509
${{ needs.prepare-release.outputs.changelog }}
463510

0 commit comments

Comments
 (0)