Skip to content

Commit

Permalink
refactor: keep only the latest release in changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Nov 8, 2024
1 parent f1e71ec commit ef58cf5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 476 deletions.
2 changes: 1 addition & 1 deletion .releaserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins:
- - "@semantic-release/release-notes-generator"
- preset: simple-preset
- - "@semantic-release/exec"
- prepareCmd: "replace-in-file \"== Changelog ==\" \"== Changelog ==\n\n${nextRelease.notes}\" readme.txt"
- prepareCmd: 'export nextReleaseNotes="${nextRelease.notes}" && node bin/update-changelog.js'
- - "@semantic-release/exec"
- prepareCmd: grunt version::${nextRelease.version} && grunt wp_readme_to_markdown
- - "semantic-release-slack-bot"
Expand Down
20 changes: 20 additions & 0 deletions bin/update-changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const replace = require('replace-in-file');

async function updateChangelog() {
const options = {
files: 'readme.txt',
from: /== Changelog ==[\s\S]*?\[See changelog for all versions\]/,
to: (match) => {
return `== Changelog ==\n\n${process.env.nextReleaseNotes}\n\n[See changelog for all versions]`;
},
encoding: 'utf8',
};
try {
const results = await replace(options);
console.log('Replacement results:', results);
} catch (error) {
console.error('Error occurred:', error);
}
}

updateChangelog();
Loading

0 comments on commit ef58cf5

Please sign in to comment.