Add commit hash to footer for deployment verification
All checks were successful
CI / test (push) Successful in 14m6s
Deploy / deploy (push) Successful in 11m25s

- Display git commit hash in footer to track deployed version
- Create cross-platform build script to inject commit hash
- Update build process to include version information

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Derek Slenk 2025-07-16 17:42:21 -04:00
parent 3cc65c3a1e
commit f6ddce9290
5 changed files with 65 additions and 3 deletions

33
scripts/set-git-commit.js Normal file
View file

@ -0,0 +1,33 @@
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
try {
// Get the short commit hash
const gitCommit = execSync('git rev-parse --short HEAD').toString().trim();
// Create .env.local file with the commit hash
const envContent = `NEXT_PUBLIC_GIT_COMMIT=${gitCommit}\n`;
const envPath = path.join(process.cwd(), '.env.local');
// Read existing .env.local if it exists
let existingContent = '';
if (fs.existsSync(envPath)) {
existingContent = fs.readFileSync(envPath, 'utf8');
// Remove any existing NEXT_PUBLIC_GIT_COMMIT line
existingContent = existingContent.split('\n')
.filter(line => !line.startsWith('NEXT_PUBLIC_GIT_COMMIT='))
.join('\n');
if (existingContent && !existingContent.endsWith('\n')) {
existingContent += '\n';
}
}
// Write the updated content
fs.writeFileSync(envPath, existingContent + envContent);
console.log(`Git commit hash set: ${gitCommit}`);
} catch (error) {
console.error('Error setting git commit:', error.message);
process.exit(1);
}