release.jsโข3.5 kB
#!/usr/bin/env node
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
const versionType = process.argv[2] || 'patch'; // patch, minor, major
if (!['patch', 'minor', 'major'].includes(versionType)) {
console.error('โ Invalid version type. Use: patch, minor, or major');
process.exit(1);
}
console.log(`๐ Creating ${versionType} release...`);
try {
// 1. Update version in package.json
console.log('๐ฆ Updating version...');
execSync(`npm version ${versionType}`, { stdio: 'inherit' });
// 2. Build the project
console.log('๐จ Building project...');
execSync('npm run build', { stdio: 'inherit' });
// 3. Run tests
console.log('๐งช Running tests...');
execSync('npm test', { stdio: 'inherit' });
// 4. Get the new version
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const newVersion = packageJson.version;
// 5. Create git tag
console.log(`๐ท๏ธ Creating git tag v${newVersion}...`);
execSync(`git tag v${newVersion}`, { stdio: 'inherit' });
// 6. Push changes and tags
console.log('๐ค Pushing changes and tags...');
execSync('git push', { stdio: 'inherit' });
execSync('git push --tags', { stdio: 'inherit' });
// 7. Publish to NPM (using GitHub Actions)
console.log('๐ฆ Publishing to NPM via GitHub Actions...');
console.log(' Note: Publishing will be handled by the automated workflow');
// 8. Create GitHub release
console.log('๐ Creating GitHub release...');
const releaseNotes = generateReleaseNotes(newVersion, versionType);
execSync(`gh release create v${newVersion} --title "Sociona MCP Server v${newVersion}" --notes "${releaseNotes}"`, { stdio: 'inherit' });
console.log(`โ
Successfully released v${newVersion}!`);
console.log(`๐ฆ NPM: https://www.npmjs.com/package/sociona-mcp-server`);
console.log(`๐ GitHub: https://github.com/fav-devs/sociona-mcp-server/releases/tag/v${newVersion}`);
} catch (error) {
console.error('โ Release failed:', error.message);
process.exit(1);
}
function generateReleaseNotes(version, type) {
const features = [
'Complete MCP server implementation for Sociona social media API',
'Support for X (Twitter), Instagram, and Threads',
'CLI tool for easy execution (`sociona-mcp`)',
'Comprehensive documentation and installation guides'
];
const changes = {
major: '๐ Major release with breaking changes and new features',
minor: 'โจ New features and improvements',
patch: '๐ Bug fixes and minor improvements'
};
return `## ${changes[type]}
### Features
${features.map(f => `- ${f}`).join('\n')}
### Installation
\`\`\`bash
npm install -g sociona-mcp-server
\`\`\`
### What's New
- โ
Publish posts immediately
- โ
Schedule posts for future publication
- โ
Cancel scheduled posts
- โ
List connected social accounts
- โ
Retrieve post history and analytics
- โ
Multi-platform support (X, Instagram, Threads)
- โ
CLI tool for easy execution
- โ
Comprehensive documentation
### Documentation
- [Installation Guide](https://github.com/fav-devs/sociona-mcp-server#installation)
- [Usage Examples](https://github.com/fav-devs/sociona-mcp-server#usage)
- [Developer Setup](https://github.com/fav-devs/sociona-mcp-server/blob/main/DEVELOPER_INSTALLATION.md)
### Links
- [NPM Package](https://www.npmjs.com/package/sociona-mcp-server)
- [GitHub Repository](https://github.com/fav-devs/sociona-mcp-server)`;
}