update github release note

This commit is contained in:
duanfuxiang 2025-01-06 21:17:22 +08:00
parent 38d6fb33a1
commit 0bc8544411
4 changed files with 101 additions and 35 deletions

View File

@ -2,40 +2,83 @@
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
// Get version from command line argument
const version = process.argv[2];
if (!version) {
console.error('Please provide version as argument');
console.error('Error: Please provide version as argument');
process.exit(1);
}
// Read CHANGELOG.md
const changelogPath = path.join(process.cwd(), 'CHANGELOG.md');
const content = fs.readFileSync(changelogPath, 'utf8');
// Split content into sections by h2 headers
const sections = content.split(/\n## /);
// Find the section for the specified version
const versionSection = sections.find(section => section.trim().startsWith(version));
if (!versionSection) {
console.error(`No changelog found for version ${version}`);
try {
// Read CHANGELOG.yaml
const changelogPath = path.join(process.cwd(), 'CHANGELOG.yaml');
const content = fs.readFileSync(changelogPath, 'utf8');
// Parse YAML content
const changelog = yaml.load(content);
if (!changelog || !Array.isArray(changelog.releases)) {
console.error('Error: Invalid changelog format. Expected array of releases.');
process.exit(1);
}
// Find the release entry for the specified version
const release = changelog.releases.find(r => r.version === version);
if (!release) {
console.error(`Error: No changelog found for version ${version}`);
process.exit(1);
}
// Format the release notes
let output = '';
// Features
if (release.features && release.features.length > 0) {
output += '### ✨ New Features\n\n';
release.features.forEach(feature => {
output += `- ${feature}\n`;
});
output += '\n';
}
// Fixes
if (release.fixes && release.fixes.length > 0) {
output += '### 🐛 Bug Fixes\n\n';
release.fixes.forEach(fix => {
output += `- ${fix}\n`;
});
output += '\n';
}
// Improvements
if (release.improvements && release.improvements.length > 0) {
output += '### 🚀 Improvements\n\n';
release.improvements.forEach(improvement => {
output += `- ${improvement}\n`;
});
output += '\n';
}
// Other changes
if (release.other && release.other.length > 0) {
output += '### 📝 Other Changes\n\n';
release.other.forEach(change => {
output += `- ${change}\n`;
});
}
if (!output) {
console.error('Error: No changes found in the release');
process.exit(1);
}
// Output the formatted release notes
console.log(output.trim());
} catch (error) {
console.error(`Error processing changelog: ${error.message}`);
process.exit(1);
}
// Extract and format the changelog entries
const lines = versionSection
.split('\n')
.slice(1) // Remove the version line itself
.filter(line => line.trim().startsWith('- ')) // Only keep bullet points
.join('\n')
.trim();
if (!lines) {
console.error('No bullet points found in changelog section');
process.exit(1);
}
console.log(lines);

View File

@ -23,6 +23,7 @@ jobs:
id: build
run: |
npm install
npm install js-yaml
npm run build
- name: Test

View File

@ -1,7 +0,0 @@
# Changelog
## 0.0.2
### Fixed
- Fixed memory leak in chat interface
- Corrected markdown rendering issues

29
CHANGELOG.yaml Normal file
View File

@ -0,0 +1,29 @@
releases:
- version: "0.0.2"
improvements:
- "Converted webp to gif format for better compatibility"
- "Added demo gif for better documentation"
other:
- "Updated GitHub release process"
- "Updated release notes"
- "Added changelog documentation"
- "Removed unused markdown files and low quality demo images"
- version: "0.0.1"
features:
- "Implemented real-time code suggestions"
- "Initial release of obsidian-infio-copilot plugin"
- "Basic functionality for AI-powered assistance in Obsidian"
- "Interactive chat with selected notes"
- "Smart autocomplete based on your notes"
- "Enhanced user experience with customizable prompts"
- "Integration with Obsidian's search functionality"
fixes:
- "Fixed markdown rendering issues in the editor"
- "Resolved connection timeout problems"
improvements:
- "Enhanced code completion performance"
- "Optimized memory usage"
other:
- "Updated documentation"
- "Added more test coverage"