ccman 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +41 -155
- package/package.json +1 -1
- package/release-temp/package.json +1 -1
|
@@ -1,213 +1,99 @@
|
|
|
1
1
|
name: Release and Publish
|
|
2
2
|
|
|
3
|
-
# 触发条件:推送 tag
|
|
3
|
+
# 触发条件:推送 tag
|
|
4
4
|
on:
|
|
5
5
|
push:
|
|
6
6
|
tags:
|
|
7
|
-
- 'v*.*.*' # 匹配语义化版本标签
|
|
8
|
-
workflow_dispatch: # 支持手动触发
|
|
9
|
-
inputs:
|
|
10
|
-
version:
|
|
11
|
-
description: 'Release version (e.g., 1.0.0)'
|
|
12
|
-
required: true
|
|
13
|
-
default: 'patch'
|
|
14
|
-
type: choice
|
|
15
|
-
options:
|
|
16
|
-
- patch
|
|
17
|
-
- minor
|
|
18
|
-
- major
|
|
7
|
+
- 'v*.*.*' # 匹配语义化版本标签
|
|
19
8
|
|
|
20
9
|
jobs:
|
|
21
10
|
release:
|
|
22
|
-
name:
|
|
11
|
+
name: Build, Test and Release
|
|
23
12
|
runs-on: ubuntu-latest
|
|
24
|
-
|
|
13
|
+
|
|
25
14
|
permissions:
|
|
26
|
-
contents: write #
|
|
27
|
-
id-token: write # NPM
|
|
15
|
+
contents: write # 创建 release
|
|
16
|
+
id-token: write # NPM 发布
|
|
28
17
|
|
|
29
18
|
steps:
|
|
30
19
|
# 1. 检出代码
|
|
31
|
-
- name: Checkout
|
|
20
|
+
- name: Checkout
|
|
32
21
|
uses: actions/checkout@v4
|
|
33
22
|
with:
|
|
34
|
-
fetch-depth: 0
|
|
23
|
+
fetch-depth: 0
|
|
35
24
|
|
|
36
25
|
# 2. 设置 pnpm
|
|
37
26
|
- name: Setup pnpm
|
|
38
27
|
uses: pnpm/action-setup@v4
|
|
39
28
|
with:
|
|
40
|
-
version: 8.15.1
|
|
29
|
+
version: 8.15.1
|
|
41
30
|
|
|
42
|
-
# 3. 设置 Node.js
|
|
31
|
+
# 3. 设置 Node.js
|
|
43
32
|
- name: Setup Node.js
|
|
44
33
|
uses: actions/setup-node@v4
|
|
45
34
|
with:
|
|
46
35
|
node-version: '18'
|
|
47
36
|
cache: 'pnpm'
|
|
37
|
+
registry-url: 'https://registry.npmjs.org'
|
|
48
38
|
|
|
49
|
-
# 4.
|
|
50
|
-
- name: Install
|
|
51
|
-
run: pnpm install
|
|
52
|
-
|
|
53
|
-
# 5. 运行测试和代码检查
|
|
54
|
-
- name: Run tests and linting
|
|
39
|
+
# 4. 安装依赖和构建
|
|
40
|
+
- name: Install and Build
|
|
55
41
|
run: |
|
|
42
|
+
pnpm install
|
|
56
43
|
pnpm run lint
|
|
57
44
|
pnpm run build
|
|
58
|
-
continue-on-error: false
|
|
59
45
|
|
|
60
|
-
#
|
|
61
|
-
- name: Get version
|
|
46
|
+
# 5. 获取版本信息
|
|
47
|
+
- name: Get version
|
|
62
48
|
id: version
|
|
63
49
|
run: |
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
|
69
|
-
else
|
|
70
|
-
# 手动触发时使用输入的版本
|
|
71
|
-
VERSION=$(npm version ${{ github.event.inputs.version }} --no-git-tag-version --preid=beta)
|
|
72
|
-
VERSION=${VERSION#v}
|
|
73
|
-
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
74
|
-
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
|
|
75
|
-
fi
|
|
76
|
-
echo "package_version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
|
|
77
|
-
|
|
78
|
-
# 7. 验证版本一致性(仅对 tag 触发的构建)
|
|
79
|
-
- name: Validate version consistency
|
|
80
|
-
if: github.event_name == 'push'
|
|
81
|
-
run: |
|
|
82
|
-
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
83
|
-
TAG_VERSION="${{ steps.version.outputs.version }}"
|
|
84
|
-
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
|
|
85
|
-
echo "❌ Version mismatch: package.json($PACKAGE_VERSION) != tag($TAG_VERSION)"
|
|
86
|
-
exit 1
|
|
87
|
-
fi
|
|
88
|
-
echo "✅ Version validation passed: $PACKAGE_VERSION"
|
|
50
|
+
VERSION=${GITHUB_REF#refs/tags/v}
|
|
51
|
+
TAG=${GITHUB_REF#refs/tags/}
|
|
52
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
53
|
+
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
89
54
|
|
|
90
|
-
#
|
|
91
|
-
- name: Build project
|
|
92
|
-
run: |
|
|
93
|
-
pnpm run clean
|
|
94
|
-
pnpm run build
|
|
95
|
-
|
|
96
|
-
# 9. 创建发布包
|
|
55
|
+
# 6. 创建发布包
|
|
97
56
|
- name: Create release archive
|
|
98
57
|
run: |
|
|
99
|
-
# 创建临时目录用于打包
|
|
100
58
|
mkdir -p release-temp
|
|
59
|
+
cp -r dist package.json README.md release-temp/
|
|
60
|
+
cd release-temp && tar -czf ../ccman-${{ steps.version.outputs.tag }}.tar.gz .
|
|
101
61
|
|
|
102
|
-
|
|
103
|
-
cp -r dist release-temp/
|
|
104
|
-
cp package.json release-temp/
|
|
105
|
-
cp README.md release-temp/
|
|
106
|
-
cp LICENSE release-temp/ 2>/dev/null || echo "No LICENSE file found"
|
|
107
|
-
|
|
108
|
-
# 创建压缩包
|
|
109
|
-
cd release-temp
|
|
110
|
-
tar -czf ../ccm-v${{ steps.version.outputs.version }}.tar.gz .
|
|
111
|
-
cd ..
|
|
112
|
-
|
|
113
|
-
echo "✅ Release archive created: ccm-v${{ steps.version.outputs.version }}.tar.gz"
|
|
114
|
-
|
|
115
|
-
# 10. 配置 NPM 认证
|
|
116
|
-
- name: Configure NPM authentication
|
|
117
|
-
run: |
|
|
118
|
-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
|
|
119
|
-
ls -la ~/
|
|
120
|
-
echo "NPM configuration:"
|
|
121
|
-
cat ~/.npmrc
|
|
122
|
-
|
|
123
|
-
# 11. 验证 NPM 认证
|
|
124
|
-
- name: Verify NPM authentication
|
|
125
|
-
run: |
|
|
126
|
-
npm whoami
|
|
127
|
-
echo "✅ NPM authentication verified"
|
|
128
|
-
|
|
129
|
-
# 12. 发布到 NPM(使用 npm 确保兼容性)
|
|
62
|
+
# 7. 发布到 NPM
|
|
130
63
|
- name: Publish to NPM
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
VERSION="${{ steps.version.outputs.version }}"
|
|
136
|
-
if [[ "$VERSION" =~ -beta\.|alpha\.|rc\. ]]; then
|
|
137
|
-
echo "📦 Publishing pre-release version $VERSION with 'beta' tag"
|
|
138
|
-
npm publish --tag beta --access public
|
|
139
|
-
else
|
|
140
|
-
echo "📦 Publishing stable version $VERSION"
|
|
141
|
-
npm publish --access public
|
|
142
|
-
fi
|
|
143
|
-
|
|
144
|
-
echo "✅ Published to NPM successfully"
|
|
64
|
+
uses: JS-DevTools/npm-publish@v3
|
|
65
|
+
with:
|
|
66
|
+
token: ${{ secrets.NPM_TOKEN }}
|
|
67
|
+
access: public
|
|
145
68
|
|
|
146
|
-
#
|
|
69
|
+
# 8. 创建 GitHub Release
|
|
147
70
|
- name: Create GitHub Release
|
|
148
|
-
uses:
|
|
149
|
-
env:
|
|
150
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
71
|
+
uses: softprops/action-gh-release@v2
|
|
151
72
|
with:
|
|
152
|
-
|
|
153
|
-
release_name: "CCM v${{ steps.version.outputs.version }}"
|
|
73
|
+
name: "CCMan ${{ steps.version.outputs.tag }}"
|
|
154
74
|
body: |
|
|
155
|
-
##
|
|
75
|
+
## CCMan (Claude Code Manager) ${{ steps.version.outputs.tag }}
|
|
156
76
|
|
|
157
77
|
🚀 **新版本发布!**
|
|
158
78
|
|
|
159
79
|
### 📦 安装方式
|
|
160
80
|
```bash
|
|
161
|
-
npm install -g
|
|
81
|
+
npm install -g ccman@${{ steps.version.outputs.version }}
|
|
162
82
|
```
|
|
163
83
|
|
|
164
84
|
### 🔗 相关链接
|
|
165
|
-
- [NPM 包](https://www.npmjs.com/package/
|
|
166
|
-
- [GitHub 仓库](https://github.com
|
|
167
|
-
- [中文文档](./README_zh.md)
|
|
85
|
+
- [NPM 包](https://www.npmjs.com/package/ccman)
|
|
86
|
+
- [GitHub 仓库](https://github.com/${{ github.repository }})
|
|
168
87
|
|
|
169
88
|
### 📋 发布信息
|
|
170
|
-
- **发布时间**: ${{ github.event.head_commit.timestamp }}
|
|
171
89
|
- **提交哈希**: ${{ github.sha }}
|
|
172
|
-
- **构建环境**: GitHub Actions
|
|
90
|
+
- **构建环境**: GitHub Actions
|
|
173
91
|
|
|
174
92
|
---
|
|
175
|
-
|
|
176
|
-
|
|
93
|
+
*通过 GitHub Actions 自动构建发布*
|
|
94
|
+
files: |
|
|
95
|
+
ccman-*.tar.gz
|
|
177
96
|
draft: false
|
|
178
|
-
prerelease: ${{ contains(
|
|
179
|
-
|
|
180
|
-
# 14. 上传发布文件到 Release
|
|
181
|
-
- name: Upload release assets
|
|
182
|
-
uses: actions/upload-release-asset@v1
|
|
97
|
+
prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-rc') }}
|
|
183
98
|
env:
|
|
184
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
185
|
-
with:
|
|
186
|
-
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
187
|
-
asset_path: ./ccm-v${{ steps.version.outputs.version }}.tar.gz
|
|
188
|
-
asset_name: ccm-v${{ steps.version.outputs.version }}.tar.gz
|
|
189
|
-
asset_content_type: application/gzip
|
|
190
|
-
|
|
191
|
-
# 15. 发布结果通知
|
|
192
|
-
- name: Release Summary
|
|
193
|
-
run: |
|
|
194
|
-
echo "## 🎉 发布成功 v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
|
195
|
-
echo "" >> $GITHUB_STEP_SUMMARY
|
|
196
|
-
echo "### 📋 发布详情" >> $GITHUB_STEP_SUMMARY
|
|
197
|
-
echo "- **版本**: ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
|
198
|
-
echo "- **NPM**: https://www.npmjs.com/package/ccm/v/${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
|
199
|
-
echo "- **GitHub Release**: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
|
|
200
|
-
echo "- **安装命令**: \`npm install -g ccm@${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
|
|
201
|
-
|
|
202
|
-
# 可选:部署文档或通知其他系统
|
|
203
|
-
post-release:
|
|
204
|
-
name: Post-release tasks
|
|
205
|
-
needs: release
|
|
206
|
-
runs-on: ubuntu-latest
|
|
207
|
-
if: always()
|
|
208
|
-
|
|
209
|
-
steps:
|
|
210
|
-
- name: Post-release cleanup
|
|
211
|
-
run: |
|
|
212
|
-
echo "✅ Release workflow completed"
|
|
213
|
-
echo "Version ${{ needs.release.outputs.version }} has been published"
|
|
99
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/package.json
CHANGED