Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ‘· ci: improve canary versioning to patch+1 sequential numbering (#12347)

Innei8b0d1ec9e3ff
diff --git a/.github/workflows/release-desktop-canary.yml b/.github/workflows/release-desktop-canary.yml
index 9aac6e0a99a..7882ef90e3f 100644
--- a/.github/workflows/release-desktop-canary.yml
+++ b/.github/workflows/release-desktop-canary.yml
@@ -4,15 +4,16 @@ name: Release Desktop Canary
# Canary θ‡ͺεŠ¨ε‘η‰ˆε·₯作桁
# ============================================
# 触发村仢:
-# 1. canary εˆ†ζ”―ζœ‰ push (合ε…₯ PR) δΈ” commit 前缀为 style/feat/fix/refactor
+# 1. canary εˆ†ζ”―ζœ‰ push (合ε…₯ PR) δΈ” commit 前缀为 style/feat/fix/refactor/release (ζ”―ζŒ gitmoji)
# 2. ζ‰‹εŠ¨θ§¦ε‘ (workflow_dispatch)
#
# 幢发策η•₯:
# εŒδΈ€ workflow δ»…δΏη•™ζœ€ζ–°δΈ€ζ¬‘θΏθ‘ŒοΌŒθ‡ͺεŠ¨ε–ζΆˆζŽ’ι˜ŸδΈ­ηš„ζ—§ build
#
# η‰ˆζœ¬η­–η•₯:
-# εŸΊδΊŽζœ€ζ–° stable tag ηš„ minor+1, 格式: X.(Y+1).0-canary.YYYYMMDDHHMM
-# δΎ‹: 当前 tag v2.1.28 β†’ v2.2.0-canary.202602121400
+# εŸΊδΊŽζœ€ζ–° stable tag ηš„ patch+1, postfix δΈΊι€’ε’žεΊε·
+# 格式: X.Y.(Z+1)-canary.N
+# δΎ‹: 当前 tag v2.1.28 β†’ v2.1.29-canary.1, 下欑 β†’ v2.1.29-canary.2
# ============================================
on:
@@ -74,13 +75,13 @@ jobs:
commit_msg=$(git log -1 --pretty=%s HEAD)
echo "πŸ“ Head commit: $commit_msg"
- # ζ£€ζŸ₯ζ˜―ε¦εŒΉι… style/feat/fix/refactor 前缀 (ζ”―ζŒ gitmoji 前缀)
- if echo "$commit_msg" | grep -qiE '^(πŸ’„\s*)?style(\(.+\))?:|^(✨\s*)?feat(\(.+\))?:|^(πŸ›\s*)?fix(\(.+\))?:|^(♻️\s*)?refactor(\(.+\))?:'; then
+ # ζ£€ζŸ₯ζ˜―ε¦εŒΉι… style/feat/fix/refactor/release 前缀 (ζ”―ζŒ gitmoji 前缀)
+ if echo "$commit_msg" | grep -qiE '^(πŸ’„\s*)?style(\(.+\))?:|^(✨\s*)?feat(\(.+\))?:|^(πŸ›\s*)?fix(\(.+\))?:|^(♻️\s*)?refactor(\(.+\))?:|^(πŸš€\s*)?release(\(.+\))?:'; then
echo "should_build=true" >> $GITHUB_OUTPUT
echo "βœ… Commit matches canary build trigger: $commit_msg"
else
echo "should_build=false" >> $GITHUB_OUTPUT
- echo "⏭️ Commit does not match style/feat/fix/refactor prefix, skipping: $commit_msg"
+ echo "⏭️ Commit does not match style/feat/fix/refactor/release prefix, skipping: $commit_msg"
fi
- name: Calculate canary version
@@ -97,17 +98,23 @@ jobs:
echo "πŸ“Œ Latest stable tag: $latest_tag"
- # εŽ»ζŽ‰ v 前缀
+ # εŽ»ζŽ‰ v ε‰ηΌ€οΌŒθ§£ζž major.minor.patch β†’ a.b.c 取 c+1
base_version="${latest_tag#v}"
-
- # 解析 major.minor.patch
IFS='.' read -r major minor patch <<< "$base_version"
-
- # minor + 1, patch ε½’ι›Ά
- new_minor=$((minor + 1))
- timestamp=$(date -u +"%Y%m%d%H%M")
-
- version="${major}.${new_minor}.0-canary.${timestamp}"
+ new_patch=$((patch + 1))
+ base_canary="${major}.${minor}.${new_patch}"
+
+ # postfix: 同 base δΈ‹ε·²ζœ‰ canary ζ ‡η­Ύηš„ζœ€ε€§εΊε· + 1
+ max_seq=0
+ for t in $(git tag -l "v${base_canary}-canary.*" 2>/dev/null || true); do
+ seq=$(echo "$t" | grep -oE '[0-9]+$' || true)
+ if [ -n "$seq" ] && [ "$seq" -gt "$max_seq" ] 2>/dev/null; then
+ max_seq=$seq
+ fi
+ done
+ next_seq=$((max_seq + 1))
+
+ version="${base_canary}-canary.${next_seq}"
tag="v${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
diff --git a/.github/workflows/sync-main-to-canary.yaml b/.github/workflows/sync-main-to-canary.yaml
index d61d49d7f0e..303b36d523a 100644
--- a/.github/workflows/sync-main-to-canary.yaml
+++ b/.github/workflows/sync-main-to-canary.yaml
@@ -81,7 +81,7 @@ jobs:
gh pr create \
--base canary \
--head "$SYNC_BRANCH" \
- --title "Sync main branch to canary branch" \
+ --title "πŸš€ release: sync main branch to canary" \
--body "Automatic sync from main to canary. Direct push failed, please merge this PR." || true
exit 0
fi
@@ -121,7 +121,7 @@ jobs:
gh pr create \
--base canary \
--head "$SYNC_BRANCH" \
- --title "Sync main branch to canary branch" \
+ --title "πŸš€ release: sync main branch to canary" \
--body-file /tmp/pr-body.md
fi
env: