ccman 0.1.1 → 0.1.2
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/package.json
CHANGED
|
@@ -74,12 +74,13 @@ check_github_actions() {
|
|
|
74
74
|
# 检查最新的workflow运行状态
|
|
75
75
|
local api_response=$(curl -s "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/actions/runs?per_page=1" 2>/dev/null || echo "")
|
|
76
76
|
|
|
77
|
-
if [ -n "$api_response" ]; then
|
|
77
|
+
if [ -n "$api_response" ] && ! echo "$api_response" | grep -q '"message"'; then
|
|
78
78
|
local run_status=$(echo "$api_response" | grep -o '"status":"[^"]*"' | head -1 | cut -d'"' -f4 2>/dev/null || echo "unknown")
|
|
79
79
|
local run_conclusion=$(echo "$api_response" | grep -o '"conclusion":"[^"]*"' | head -1 | cut -d'"' -f4 2>/dev/null || echo "null")
|
|
80
80
|
|
|
81
81
|
case "$run_status" in
|
|
82
82
|
"completed")
|
|
83
|
+
echo # 换行
|
|
83
84
|
if [ "$run_conclusion" = "success" ]; then
|
|
84
85
|
print_success "GitHub Actions 构建成功! ✨"
|
|
85
86
|
return 0
|
|
@@ -156,9 +157,13 @@ check_github_release() {
|
|
|
156
157
|
|
|
157
158
|
if [ -n "$release_response" ] && ! echo "$release_response" | grep -q '"message":"Not Found"'; then
|
|
158
159
|
# 检查release状态
|
|
159
|
-
local release_draft=$(echo "$release_response" | grep -o '"draft":[^,}]*' | cut -d':' -f2 2>/dev/null || echo "true")
|
|
160
|
+
local release_draft=$(echo "$release_response" | grep -o '"draft":[^,}]*' | cut -d':' -f2 | tr -d ' ' 2>/dev/null || echo "true")
|
|
161
|
+
|
|
162
|
+
# 调试输出
|
|
163
|
+
# echo "[DEBUG] release_draft = '$release_draft'" >&2
|
|
160
164
|
|
|
161
165
|
if [ "$release_draft" = "false" ]; then
|
|
166
|
+
echo # 换行
|
|
162
167
|
print_success "GitHub Release v$version 创建成功! 🎉"
|
|
163
168
|
return 0
|
|
164
169
|
else
|
|
@@ -220,7 +225,7 @@ generate_summary() {
|
|
|
220
225
|
fi
|
|
221
226
|
}
|
|
222
227
|
|
|
223
|
-
# 主函数:
|
|
228
|
+
# 主函数: 监控发布状态(只监控NPM和Release)
|
|
224
229
|
monitor_release() {
|
|
225
230
|
local version=$(get_version_info)
|
|
226
231
|
local commit_id=$(get_latest_commit)
|
|
@@ -232,8 +237,12 @@ monitor_release() {
|
|
|
232
237
|
print_info "超时: ${MAX_WAIT_MINUTES} 分钟"
|
|
233
238
|
echo ""
|
|
234
239
|
|
|
235
|
-
#
|
|
236
|
-
|
|
240
|
+
# 显示监控链接(只显示需要的)
|
|
241
|
+
print_info "📊 监控链接:"
|
|
242
|
+
echo " 🔗 NPM Package: https://www.npmjs.com/package/${PACKAGE_NAME}"
|
|
243
|
+
echo " 🔗 NPM Version: https://www.npmjs.com/package/${PACKAGE_NAME}/v/${version}"
|
|
244
|
+
echo " 🔗 GitHub Release: https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/tag/v${version}"
|
|
245
|
+
echo ""
|
|
237
246
|
|
|
238
247
|
# 检查curl是否可用
|
|
239
248
|
if ! command -v curl &> /dev/null; then
|
|
@@ -242,16 +251,11 @@ monitor_release() {
|
|
|
242
251
|
return 1
|
|
243
252
|
fi
|
|
244
253
|
|
|
245
|
-
# 并行监控各个状态
|
|
246
254
|
print_info "开始监控发布状态... (最长等待 ${MAX_WAIT_MINUTES} 分钟)"
|
|
247
255
|
echo ""
|
|
248
256
|
|
|
249
|
-
# 检查GitHub Actions
|
|
250
|
-
check_github_actions
|
|
251
|
-
local actions_status=$?
|
|
252
|
-
|
|
253
257
|
# 检查NPM包发布
|
|
254
|
-
check_npm_package "$version"
|
|
258
|
+
check_npm_package "$version"
|
|
255
259
|
local npm_status=$?
|
|
256
260
|
|
|
257
261
|
# 检查GitHub Release
|
|
@@ -259,7 +263,31 @@ monitor_release() {
|
|
|
259
263
|
local release_status=$?
|
|
260
264
|
|
|
261
265
|
# 生成总结报告
|
|
262
|
-
|
|
266
|
+
echo ""
|
|
267
|
+
echo "📋 发布监控总结"
|
|
268
|
+
echo "================"
|
|
269
|
+
echo " 版本: v$version"
|
|
270
|
+
echo " NPM 包发布: $(get_status_icon $npm_status)"
|
|
271
|
+
echo " GitHub Release: $(get_status_icon $release_status)"
|
|
272
|
+
echo ""
|
|
273
|
+
|
|
274
|
+
# 结果判断
|
|
275
|
+
if [ $npm_status -eq 0 ] && [ $release_status -eq 0 ]; then
|
|
276
|
+
print_success "🎉 发布完成!NPM包和GitHub Release都已正常发布"
|
|
277
|
+
return 0
|
|
278
|
+
elif [ $npm_status -eq 2 ] || [ $release_status -eq 2 ]; then
|
|
279
|
+
print_warning "⚠️ 发布监控超时 (${MAX_WAIT_MINUTES}分钟),请手动检查:"
|
|
280
|
+
if [ $npm_status -eq 2 ]; then
|
|
281
|
+
echo " • NPM包状态: https://www.npmjs.com/package/${PACKAGE_NAME}/v/${version}"
|
|
282
|
+
fi
|
|
283
|
+
if [ $release_status -eq 2 ]; then
|
|
284
|
+
echo " • GitHub Release: https://github.com/${REPO_OWNER}/${REPO_NAME}/releases/tag/v${version}"
|
|
285
|
+
fi
|
|
286
|
+
return 2
|
|
287
|
+
else
|
|
288
|
+
print_warning "⚠️ 发布部分失败,请手动检查上述链接"
|
|
289
|
+
return 1
|
|
290
|
+
fi
|
|
263
291
|
}
|
|
264
292
|
|
|
265
293
|
# 如果直接运行此脚本
|