chore: switch branch indicator to main and auto-sync Vercel build branch
Deploy GaC-Srtool to GitHub Pages / deploy (push) Canceled after 0s

This commit is contained in:
CAtlas0784 committed 2026-11-01 19:37:47 +07:00
1 parent f0b14c8d6f
commit 1177d205d1
2 files changed
+18 -2

No files matched your search

+16
View File
@@ -5,6 +5,22 @@ const path = require('node:path');
const root = path.resolve(__dirname, '..');
const output = path.join(root, 'dist');
fs.mkdirSync(output, { recursive: true });
// If building on Vercel, update version.json with the deployed branch
const vercelBranch = process.env.VERCEL_GIT_COMMIT_REF;
const versionFile = path.join(root, 'version.json');
if (vercelBranch && fs.existsSync(versionFile)) {
try {
const data = JSON.parse(fs.readFileSync(versionFile, 'utf8'));
data.branch = vercelBranch;
data.updatedAt = new Date().toISOString();
fs.writeFileSync(versionFile, JSON.stringify(data, null, 2) + '\n');
console.log(`[build-vercel] Synced branch to: ${vercelBranch}`);
} catch (err) {
console.warn('[build-vercel] Could not update branch:', err.message);
}
}
for (const name of ['index.html', 'version.json', 'assets', 'css', 'js']) {
const source = path.join(root, name);
if (!fs.existsSync(source)) throw new Error(`Missing static application input: ${name}`);