Add git commit info to UI and update deployment script

This commit is contained in:
2025-12-27 19:00:15 +11:00
parent 2b690f2dac
commit 85ca389f29
6 changed files with 887 additions and 657 deletions

28
update-version.js Normal file
View File

@@ -0,0 +1,28 @@
const fs = require('fs');
const { execSync } = require('child_process');
try {
console.log('Generating version information...');
const commit = execSync('git rev-parse --short HEAD').toString().trim();
const date = execSync('git log -1 --format=%cd --date=relative').toString().trim();
const versionInfo = {
commit: commit,
date: date
};
fs.writeFileSync('version.json', JSON.stringify(versionInfo, null, 2));
console.log('version.json updated:', versionInfo);
} catch (error) {
console.error('Failed to update version info:', error);
// Fallback if git fails (e.g. not a repo)
const versionInfo = {
commit: 'unknown',
date: 'unknown'
};
try {
fs.writeFileSync('version.json', JSON.stringify(versionInfo, null, 2));
} catch (e) {
console.error('Failed to write fallback version.json', e);
}
}