添加快速发布
Some checks failed
TDevOPsCICD / build-image (push) Has been cancelled

This commit is contained in:
cheney 2026-01-27 17:10:20 +08:00
parent 24961dc734
commit e97d7d7fd0
2 changed files with 63 additions and 0 deletions

5
kit/local.json Normal file
View File

@ -0,0 +1,5 @@
{
"linux" : "./dist/linux/kit",
"windows" : "./dist/windows/kit.exe",
"dir" : "C:\\Users\\occul\\SynologyDrive\\bin"
}

58
kit/push.js Normal file
View File

@ -0,0 +1,58 @@
// push.js
const fs = require('fs');
const path = require('path');
// 读取命令行参数
const args = process.argv.slice(2);
const platform = args[0]; // 'windows' 或 'linux'
const target = args[1]; // 目标配置键,如 'dir'
if (!platform || !target) {
console.error('用法: node push.js <平台> <目标配置键>');
console.error('示例: node push.js windows dir');
process.exit(1);
}
try {
// 读取配置文件
const configPath = path.join(__dirname, 'local.json');
const configData = JSON.parse(fs.readFileSync(configPath, 'utf8'));
// 验证参数
if (!configData[platform]) {
console.error(`错误: 配置文件中找不到平台 "${platform}"`);
process.exit(1);
}
if (!configData[target]) {
console.error(`错误: 配置文件中找不到目标 "${target}"`);
process.exit(1);
}
// 获取源文件和目标目录
const sourceFile = path.resolve(__dirname, configData[platform]);
const targetDir = configData[target];
// 获取源文件名
const sourceFileName = path.basename(sourceFile);
// 创建目标路径
const targetPath = path.join(targetDir, sourceFileName);
// 确保目标目录存在
if (!fs.existsSync(targetDir)) {
console.log(`创建目录: ${targetDir}`);
fs.mkdirSync(targetDir, { recursive: true });
}
// 复制文件
fs.copyFileSync(sourceFile, targetPath);
console.log(`成功复制文件:`);
console.log(` 从: ${sourceFile}`);
console.log(` 到: ${targetPath}`);
} catch (error) {
console.error(`错误: ${error.message}`);
process.exit(1);
}