build info
TDevOPsCICD / build-image (push) Waiting to run

This commit is contained in:
cheney
2026-01-27 16:12:31 +08:00
parent d5e12945e1
commit 6ddcff5275
5 changed files with 34 additions and 8 deletions
+22
View File
@@ -0,0 +1,22 @@
// build-time.js
const fs = require('fs');
const path = require('path');
// 生成当前时间的 yyyyMMdd 格式
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const buildTime = `${year}${month}${day}`;
// 创建 JSON 对象
const buildData = {
buildTime: buildTime,
timestamp: now.toISOString()
};
// 写入文件
const filePath = path.join(__dirname, 'build.json');
fs.writeFileSync(filePath, JSON.stringify(buildData, null, 2));
console.log(`Build time ${buildTime} written to build.json`);