ai-yuca 1.5.5 → 1.5.6
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/dist/package.json +1 -1
- package/dist/src/deploy.js +43 -2
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/src/deploy.js
CHANGED
|
@@ -49,6 +49,36 @@ const upload_1 = require("./upload");
|
|
|
49
49
|
const uploadWithConfig_1 = require("./uploadWithConfig");
|
|
50
50
|
const cache_1 = require("./cache");
|
|
51
51
|
const child_process_1 = require("child_process");
|
|
52
|
+
async function reportDeployToLark(payload) {
|
|
53
|
+
const webhookUrl = process.env.LARK_DEPLOY_WEBHOOK ||
|
|
54
|
+
'https://open.larksuite.com/open-apis/bot/v2/hook/b2acaa39-8be6-4faf-bf04-9c70854167d8';
|
|
55
|
+
const lines = [
|
|
56
|
+
'✅ 发布成功',
|
|
57
|
+
`项目名: ${payload.projectName}`,
|
|
58
|
+
`发布环境: ${payload.environment}`,
|
|
59
|
+
`发布分支: ${payload.branch}`,
|
|
60
|
+
`版本号: ${payload.cdnKey}`,
|
|
61
|
+
`项目版本: ${payload.projectVersion || '-'}`,
|
|
62
|
+
`更新时间: ${new Date(payload.updatedAt).toLocaleString('zh-CN', { hour12: false })}`,
|
|
63
|
+
`文件数: ${payload.uploadedFiles}`,
|
|
64
|
+
];
|
|
65
|
+
if (payload.verificationUrl) {
|
|
66
|
+
lines.push(`验证地址: ${payload.verificationUrl}`);
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
await axios_1.default.post(webhookUrl, {
|
|
70
|
+
msg_type: 'text',
|
|
71
|
+
content: {
|
|
72
|
+
text: lines.join('\n'),
|
|
73
|
+
},
|
|
74
|
+
}, {
|
|
75
|
+
timeout: 8000,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
console.warn('⚠️ 飞书机器人上报失败:', error instanceof Error ? error.message : String(error));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
52
82
|
/**
|
|
53
83
|
* 从GCP存储读取环境配置文件
|
|
54
84
|
*/
|
|
@@ -271,6 +301,7 @@ async function deployFiles(options) {
|
|
|
271
301
|
const cdnKey = options.cdn ? ((0, cache_1.readLastUploadCacheFile)(options.cacheFile) || version) : version;
|
|
272
302
|
console.log('📖 读取项目信息...');
|
|
273
303
|
const projectInfo = getProjectInfo();
|
|
304
|
+
const branch = getBranchName();
|
|
274
305
|
console.log('🔍 筛选目标文件...');
|
|
275
306
|
const sourcePath = options.source || uploadConfig.sourcePath;
|
|
276
307
|
const htmlFiles = filterHtmlFiles(sourcePath);
|
|
@@ -350,7 +381,7 @@ async function deployFiles(options) {
|
|
|
350
381
|
baseUrl: config.deploy.baseUrl,
|
|
351
382
|
links: uploadedFiles,
|
|
352
383
|
s3Static: config.upload.s3Static,
|
|
353
|
-
branch
|
|
384
|
+
branch,
|
|
354
385
|
files: [...files, ...cdnFiles]
|
|
355
386
|
};
|
|
356
387
|
console.log('📤 上传版本配置文件...');
|
|
@@ -454,7 +485,7 @@ async function deployFiles(options) {
|
|
|
454
485
|
cdnKey,
|
|
455
486
|
version: cdnKey,
|
|
456
487
|
baseUrl: config.deploy.baseUrl,
|
|
457
|
-
branch
|
|
488
|
+
branch,
|
|
458
489
|
timestamp: Date.now(),
|
|
459
490
|
links: obj.links
|
|
460
491
|
};
|
|
@@ -507,6 +538,16 @@ async function deployFiles(options) {
|
|
|
507
538
|
const baseUrl = Array.isArray(config.deploy.baseUrl) ? config.deploy.baseUrl[0] : config.deploy.baseUrl;
|
|
508
539
|
result.verificationUrl = `${baseUrl}?deployCheck=${cdnKey}`;
|
|
509
540
|
}
|
|
541
|
+
await reportDeployToLark({
|
|
542
|
+
cdnKey,
|
|
543
|
+
projectName: projectInfo.name,
|
|
544
|
+
projectVersion: projectInfo.version,
|
|
545
|
+
environment: options.env,
|
|
546
|
+
branch,
|
|
547
|
+
uploadedFiles: uploadedFiles.length,
|
|
548
|
+
updatedAt: Date.now(),
|
|
549
|
+
verificationUrl: result.verificationUrl,
|
|
550
|
+
});
|
|
510
551
|
return result;
|
|
511
552
|
}
|
|
512
553
|
catch (error) {
|