Skip to content

Commit 379d88e

Browse files
authored
Merge pull request #233 from semantic-release/fix/versions
fix: Version replacing
2 parents ee3c7f5 + 96e28a8 commit 379d88e

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

lib/utils/replace-versions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function replaceVersions(
1414
try {
1515
const results = await rif.replaceInFile({
1616
files: files.map((file) => path.join(workDir, file)),
17-
from: currentVersion,
17+
from: new RegExp(currentVersion, 'g'),
1818
to: nextVersion,
1919
});
2020

test/2-prepare-plugin.spec.ts

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ describe('Package preparation - cusom work directory', () => {
4040
},
4141
contexts.prepareContext,
4242
);
43+
expect(
44+
fs
45+
.readFileSync(path.join(releasePath, 'plugin1', 'plugin1.php'), 'utf8')
46+
.toString(),
47+
).not.toMatch(/0\.0\.0/);
4348
});
4449

4550
it('Should fail on invalid plugin version', async () => {

test/fixtures/plugin1/plugin1.php

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
* Plugin Name: Plugin One
44
* Version: 0.0.0
55
*/
6+
7+
define('MY_VERSION', '0.0.0');

0 commit comments

Comments
 (0)