Skip to content

Commit 330495e

Browse files
committed
feat: Add custom release notes
1 parent ffa572f commit 330495e

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

.releaserc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"branches": ["main"],
33
"plugins": [
44
"@semantic-release/commit-analyzer",
5-
"@semantic-release/release-notes-generator",
5+
"./scripts/release.js",
66
"@semantic-release/changelog",
77
"@semantic-release/git",
88
{

scripts/release.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const { execSync } = require('child_process');
2+
const path = require('path');
3+
const fs = require('fs');
4+
5+
module.exports = {
6+
generateNotes: async () => {
7+
const pluginsDir = path.resolve(process.cwd(), 'plugins');
8+
let releaseNotes = `# Submodule Commit IDs\n\n`;
9+
10+
if (fs.existsSync(pluginsDir)) {
11+
const submodules = fs.readdirSync(pluginsDir);
12+
13+
submodules.forEach(submodule => {
14+
const submodulePath = path.join(pluginsDir, submodule);
15+
if (fs.existsSync(path.join(submodulePath, '.git'))) {
16+
try {
17+
const commitId = execSync(`git -C ${submodulePath} rev-parse HEAD`, { encoding: 'utf-8' }).trim();
18+
releaseNotes += `- **${submodule}**: ${commitId}\n`;
19+
} catch (error) {
20+
releaseNotes += `- **${submodule}**: Error fetching commit ID\n`;
21+
}
22+
} else {
23+
releaseNotes += `- **${submodule}**: Not a Git repository\n`;
24+
}
25+
});
26+
} else {
27+
releaseNotes += `No plugins directory found.\n`;
28+
}
29+
30+
return releaseNotes;
31+
}
32+
};

0 commit comments

Comments
 (0)