fix: CI 产物丢失 — 改为 release job 统一上传

之前各 build job 用 --publish always 并发上传到同一个 draft release,
存在竞争条件:后完成的 job overwrite 时先删后传,如果 release job
在上传未完成时执行 --draft=false,已删除的产物就丢了(DMG 丢失)。

改为:
- 各 build job 用 --publish never,产物通过 upload-artifact 上传
- release job 用 download-artifact 收集所有产物
- gh release create 一次性创建 release 并上传全部文件

同时将 .claude/rules/ 内容合回 CLAUDE.md(rules 文件与 CLAUDE.md
优先级相同,都会全量加载,拆分不减少上下文消耗)。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
7418andClaude Opus 4.6 committed 2026-03-01 23:40:31 +08:00
1 parent 6a148f2dba
commit b5e5645702
4 files changed
+86 -52

No files matched your search

-19
View File
@@ -1,19 +0,0 @@
## Development Rules
**提交前必须详尽测试:**
- 每次提交代码前,必须在开发环境中充分测试所有改动的功能,确认无回归
- 涉及前端 UI 的改动需要实际启动应用验证(`npm run dev` 或 `npm run electron:dev`)
- 涉及构建/打包的改动需要完整执行一次打包流程验证产物可用
- 涉及多平台的改动需要考虑各平台的差异性
**新增功能前必须详尽调研:**
- 新增功能前必须充分调研相关技术方案、API 兼容性、社区最佳实践
- 涉及 Electron API 需确认目标版本支持情况
- 涉及第三方库需确认与现有依赖的兼容性
- 涉及 Claude Code SDK 需确认 SDK 实际支持的功能和调用方式
- 对不确定的技术点先做 POC 验证,不要直接在主代码中试错
**Commit 信息规范:**
- 标题行使用 conventional commits 格式(feat/fix/refactor/chore 等)
- body 中按文件或功能分组,说明改了什么、为什么改、影响范围
- 修复 bug 需说明根因;架构决策需简要说明理由
-13
View File
@@ -1,13 +0,0 @@
## Release
**发版流程:** 更新 package.json version → `npm install` 同步 lock → 提交推送 → `git tag v{版本号} && git push origin v{版本号}` → CI 自动构建发布。不要手动创建 GitHub Release。
**发版纪律:** 禁止自动发版。`git push` + `git tag` 必须等用户明确指示后才执行。commit 可以正常进行。
**Release Notes 格式:** 标题 `CodePilot v{版本号}`,正文包含:更新内容、Downloads、Installation、Requirements、Changelog。
## Build Notes
- macOS 产出 DMG(arm64 + x64),Windows 产出 NSIS 安装包或 zip
- `scripts/after-pack.js` 重编译 better-sqlite3 为 Electron ABI
- 构建前清理 `rm -rf release/ .next/`;构建 Windows 包后 `npm rebuild better-sqlite3` 恢复本地环境
+53 -12
View File
@@ -39,9 +39,17 @@ jobs:
run: npm run electron:build
- name: Package for Windows
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx electron-builder --win --config electron-builder.yml --publish always
run: npx electron-builder --win --config electron-builder.yml --publish never
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-windows
path: |
release/*.exe
release/*.exe.blockmap
release/latest.yml
retention-days: 3
build-macos:
if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'macos' }}
@@ -62,9 +70,20 @@ jobs:
- name: Package for macOS (x64 + arm64)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: "false"
run: npx electron-builder --mac --config electron-builder.yml --publish always
run: npx electron-builder --mac --config electron-builder.yml --publish never
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-macos
path: |
release/*.dmg
release/*.dmg.blockmap
release/*.zip
release/*.zip.blockmap
release/latest-mac.yml
retention-days: 3
build-linux:
if: ${{ github.event_name == 'push' || inputs.platform == 'all' || inputs.platform == 'linux' }}
@@ -87,9 +106,18 @@ jobs:
run: npm run electron:build
- name: Package for Linux (${{ matrix.arch }})
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx electron-builder --linux --${{ matrix.arch }} --config electron-builder.yml --publish always
run: npx electron-builder --linux --${{ matrix.arch }} --config electron-builder.yml --publish never
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-linux-${{ matrix.arch }}
path: |
release/*.AppImage
release/*.deb
release/*.rpm
release/latest-linux*.yml
retention-days: 3
release:
if: ${{ always() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(needs.*.result, 'cancelled') }}
@@ -100,6 +128,15 @@ jobs:
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: find artifacts -type f | sort
- name: Get version and previous tag
id: meta
run: |
@@ -124,7 +161,7 @@ jobs:
echo "CHANGELOG_EOF"
} >> "$GITHUB_OUTPUT"
- name: Update release notes
- name: Create release and upload assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@@ -174,9 +211,13 @@ jobs:
CHANGELOG_INLINE_EOF
fi
# Update the draft release created by electron-builder with full notes
gh release edit "${GITHUB_REF_NAME}" \
# Collect all release files
FILES=$(find artifacts -type f \( -name "*.dmg" -o -name "*.zip" -o -name "*.exe" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.blockmap" -o -name "*.yml" \) | sort)
# Create release and upload all assets in one shot
# shellcheck disable=SC2086
gh release create "${GITHUB_REF_NAME}" \
--title "CodePilot v${VERSION}" \
--notes-file release-notes.md \
--latest \
--draft=false
$FILES
+33 -8
View File
@@ -1,15 +1,40 @@
# CLAUDE.md
## Project Overview
CodePilot — Claude Code 的桌面 GUI 客户端,基于 Electron + Next.js。
## 本地参考项目
## 开发规则
- craft-agents-oss: `/Users/op7418/Documents/code/资料/craft-agents-oss`
- opencode: `/Users/op7418/Documents/code/资料/opencode`
**提交前必须详尽测试:**
- 每次提交代码前,必须在开发环境中充分测试所有改动的功能,确认无回归
- 涉及前端 UI 的改动需要实际启动应用验证(`npm run dev` 或 `npm run electron:dev`)
- 涉及构建/打包的改动需要完整执行一次打包流程验证产物可用
- 涉及多平台的改动需要考虑各平台的差异性
## Docs
**新增功能前必须详尽调研:**
- 新增功能前必须充分调研相关技术方案、API 兼容性、社区最佳实践
- 涉及 Electron API 需确认目标版本支持情况
- 涉及第三方库需确认与现有依赖的兼容性
- 涉及 Claude Code SDK 需确认 SDK 实际支持的功能和调用方式
- 对不确定的技术点先做 POC 验证,不要直接在主代码中试错
- `docs/handover/` — 交接文档(架构、数据流、设计决策)。**检索前先读 README.md;增删文件后更新索引。**
- `docs/research/` — 调研文档(技术方案、可行性分析)。**同上。**
**Commit 信息规范:**
- 标题行使用 conventional commits 格式(feat/fix/refactor/chore 等)
- body 中按文件或功能分组,说明改了什么、为什么改、影响范围
- 修复 bug 需说明根因;架构决策需简要说明理由
## 发版
**发版流程:** 更新 package.json version → `npm install` 同步 lock → 提交推送 → `git tag v{版本号} && git push origin v{版本号}` → CI 自动构建发布。不要手动创建 GitHub Release。
**发版纪律:** 禁止自动发版。`git push` + `git tag` 必须等用户明确指示后才执行。commit 可以正常进行。
**Release Notes 格式:** 标题 `CodePilot v{版本号}`,正文包含:更新内容、Downloads、Installation、Requirements、Changelog。
**构建:** macOS 产出 DMG(arm64 + x64),Windows 产出 NSIS 安装包。`scripts/after-pack.js` 重编译 better-sqlite3 为 Electron ABI。构建前清理 `rm -rf release/ .next/`。
## 文档
- `docs/handover/` — 交接文档(架构、数据流、设计决策)
- `docs/research/` — 调研文档(技术方案、可行性分析)
**检索前先读对应目录的 README.md;增删文件后更新索引。**