Skip to content

Commit 912eebb

Browse files
Merge pull request #135 from WordPress/release-update-php-file-version
auto update version of php file
2 parents 9627c65 + a2d362d commit 912eebb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

update-version-and-changelog.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ async function updateVersion () {
3838
process.exit(1);
3939
}
4040

41+
if (!fs.existsSync('./create-block-theme.php')) {
42+
console.error("❎ Error: create-block-theme.php file not found.");
43+
process.exit(1);
44+
}
45+
4146
const package = require('./package.json');
4247
const currentVersion = package.version;
4348
const newVersion = semver.inc(currentVersion, releaseType);
@@ -74,6 +79,12 @@ async function updateVersion () {
7479
fs.writeFileSync('./readme.txt', newReadme);
7580
console.info('✅ Readme version updated', currentTag, '=>', newTag);
7681

82+
// update create-block-theme.php version
83+
const pluginPhpFile = fs.readFileSync('./create-block-theme.php', 'utf8');
84+
const newPluginPhpFile = pluginPhpFile.replace(/Version: (.*)/, `Version: ${ newVersion }`);
85+
fs.writeFileSync('./create-block-theme.php', newPluginPhpFile);
86+
console.info('✅ create-block-theme.php file version updated', currentTag, '=>', newTag);
87+
7788
// output data to be used by the next steps of the github action
7889
core.setOutput('NEW_VERSION', newVersion);
7990
core.setOutput('NEW_TAG', newTag);

0 commit comments

Comments
 (0)