Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: keep only the latest release in readme.txt #994

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .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/git"
Expand All @@ -31,4 +31,4 @@ plugins:
- pattern: master
notifyOnSuccess: true
notifyOnFail: false
- - "@semantic-release/github"
- - "@semantic-release/github"
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
Loading