Skip to content

Commit 04704c9

Browse files
Merge pull request #995 from Codeinwp/development
2 parents ae46ba3 + 54072dd commit 04704c9

File tree

4 files changed

+29
-1081
lines changed

4 files changed

+29
-1081
lines changed

.releaserc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins:
99
- - "@semantic-release/release-notes-generator"
1010
- preset: simple-preset
1111
- - "@semantic-release/exec"
12-
- prepareCmd: "replace-in-file \"== Changelog ==\" \"== Changelog ==\n\n${nextRelease.notes}\" readme.txt"
12+
- prepareCmd: 'export nextReleaseNotes="${nextRelease.notes}" && node bin/update-changelog.js'
1313
- - "@semantic-release/exec"
1414
- prepareCmd: grunt version::${nextRelease.version} && grunt wp_readme_to_markdown
1515
- - "@semantic-release/git"
@@ -31,4 +31,4 @@ plugins:
3131
- pattern: master
3232
notifyOnSuccess: true
3333
notifyOnFail: false
34-
- - "@semantic-release/github"
34+
- - "@semantic-release/github"

bin/update-changelog.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const replace = require('replace-in-file');
2+
3+
async function updateChangelog() {
4+
const options = {
5+
files: 'readme.txt',
6+
from: /== Changelog ==[\s\S]*?\[See changelog for all versions\]/,
7+
to: (match) => {
8+
return `== Changelog ==\n\n${process.env.nextReleaseNotes}\n\n[See changelog for all versions]`;
9+
},
10+
encoding: 'utf8',
11+
};
12+
try {
13+
const results = await replace(options);
14+
console.log('Replacement results:', results);
15+
} catch (error) {
16+
console.error('Error occurred:', error);
17+
}
18+
}
19+
20+
updateChangelog();

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)