All checks were successful
CI / Lint Code (push) Successful in 1m39s
CI / Security Checks (push) Successful in 1m30s
CI / Validate i18n Files (push) Successful in 9s
CI / TypeScript Type Check (push) Successful in 1m49s
CI / Build Project (push) Successful in 1m59s
CI / Run Tests (Node 18) (push) Successful in 2m8s
Auto Tag Release / Create Auto Tag (push) Successful in 2m22s
CI / Run Tests (Node 20) (push) Successful in 2m18s
CI / Test Coverage (push) Successful in 3m13s
Deploy Scripts to S3 / deploy-scripts (push) Successful in 34s
- Add scripts/server-update.sh for production deployments - Add scripts/dev-update.sh for development updates - Update repository URLs to signal-works/icewatch - Document update scripts in CLAUDE.md 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
72 lines
No EOL
2.1 KiB
JavaScript
72 lines
No EOL
2.1 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
const { execSync } = require('child_process');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
try {
|
|
// Get the current commit SHA (short version)
|
|
const fullSha = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();
|
|
const shortSha = fullSha.substring(0, 7);
|
|
|
|
// Get the current branch name
|
|
const branch = execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();
|
|
|
|
// Get the commit date
|
|
const commitDate = execSync('git log -1 --format=%cI', { encoding: 'utf8' }).trim();
|
|
|
|
// Get the commit message (first line only)
|
|
const commitMessage = execSync('git log -1 --format=%s', { encoding: 'utf8' }).trim();
|
|
|
|
const versionInfo = {
|
|
sha: fullSha,
|
|
shortSha: shortSha,
|
|
branch: branch,
|
|
commitDate: commitDate,
|
|
commitMessage: commitMessage,
|
|
buildDate: new Date().toISOString(),
|
|
gitUrl: 'https://git.deco.sh/signal-works/icewatch'
|
|
};
|
|
|
|
// Ensure dist directory exists
|
|
const distDir = path.join(__dirname, '..', 'dist');
|
|
if (!fs.existsSync(distDir)) {
|
|
fs.mkdirSync(distDir, { recursive: true });
|
|
}
|
|
|
|
// Write version info to dist directory
|
|
fs.writeFileSync(
|
|
path.join(distDir, 'version.json'),
|
|
JSON.stringify(versionInfo, null, 2)
|
|
);
|
|
|
|
console.log(`✅ Generated version info: ${shortSha} (${branch})`);
|
|
console.log(`📅 Commit date: ${commitDate}`);
|
|
console.log(`📝 Message: ${commitMessage}`);
|
|
|
|
} catch (error) {
|
|
console.warn('⚠️ Could not generate version info (not in git repository?):', error.message);
|
|
|
|
// Create fallback version info
|
|
const fallbackVersion = {
|
|
sha: 'unknown',
|
|
shortSha: 'unknown',
|
|
branch: 'unknown',
|
|
commitDate: new Date().toISOString(),
|
|
commitMessage: 'No git information available',
|
|
buildDate: new Date().toISOString(),
|
|
gitUrl: 'https://git.deco.sh/signal-works/icewatch'
|
|
};
|
|
|
|
const distDir = path.join(__dirname, '..', 'dist');
|
|
if (!fs.existsSync(distDir)) {
|
|
fs.mkdirSync(distDir, { recursive: true });
|
|
}
|
|
|
|
fs.writeFileSync(
|
|
path.join(distDir, 'version.json'),
|
|
JSON.stringify(fallbackVersion, null, 2)
|
|
);
|
|
|
|
console.log('📦 Created fallback version info');
|
|
} |