chore: switch branch indicator to main and auto-sync Vercel build branch
Deploy GaC-Srtool to GitHub Pages / deploy (push) Canceled after 0s
Deploy GaC-Srtool to GitHub Pages / deploy (push) Canceled after 0s
This commit is contained in:
1 parent
f0b14c8d6f
commit
1177d205d1
2 files changed
+18
-2
No files matched your search
@@ -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}`);
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"branch": "test-gay",
|
||||
"branch": "main",
|
||||
"version": "1.0.0",
|
||||
"updatedAt": "2026-11-01T12:30:21.299Z"
|
||||
"updatedAt": "2026-11-01T12:37:27.692Z"
|
||||
}
|
||||
Reference in new issue
Block a user