Skip to content

Commit

Permalink
Merge pull request #233 from semantic-release/fix/versions
Browse files Browse the repository at this point in the history
fix: Version replacing
  • Loading branch information
seebeen committed Jun 19, 2024
2 parents ee3c7f5 + 96e28a8 commit 379d88e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils/replace-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function replaceVersions(
try {
const results = await rif.replaceInFile({
files: files.map((file) => path.join(workDir, file)),
from: currentVersion,
from: new RegExp(currentVersion, 'g'),
to: nextVersion,
});

Expand Down
5 changes: 5 additions & 0 deletions test/2-prepare-plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ describe('Package preparation - cusom work directory', () => {
},
contexts.prepareContext,
);
expect(
fs
.readFileSync(path.join(releasePath, 'plugin1', 'plugin1.php'), 'utf8')
.toString(),
).not.toMatch(/0\.0\.0/);
});

it('Should fail on invalid plugin version', async () => {
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/plugin1/plugin1.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
* Plugin Name: Plugin One
* Version: 0.0.0
*/

define('MY_VERSION', '0.0.0');

0 comments on commit 379d88e

Please sign in to comment.