Skip to content

RegEx in "from" doesn't like ^ #277

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

Open
hcsaustrup opened this issue Mar 20, 2025 · 1 comment
Open

RegEx in "from" doesn't like ^ #277

hcsaustrup opened this issue Mar 20, 2025 · 1 comment

Comments

@hcsaustrup
Copy link

I'm updating the version of a Helm chart in the file Chart.yaml, and need to match ^version: .*$ - this gives zero matches. If I use version: .* it updates both version: lines, including the indented one.

Given this configuration:

- - semantic-release-replace-plugin
  - replacements:
    - files:
        - Chart.yaml
      from: "^version: .*"
      to: "version: ${nextRelease.version}"
      results:
        - file: Chart.yaml
          hasChanged: true
          numMatches: 1
          numReplacements: 1

I would expect this file:

# ...
version: 1.0.0
# ...
dependencies:
  - alias: dovecot
    version: "*"

To have only the first version: line updated.

Result: Nothing is replaced - ^ seems to break the RegEx matching.

Perhaps matching is done on the file as a whole, and not line-by-line?

@xakraz
Copy link

xakraz commented Apr 14, 2025

Hi @hcsaustrup 👋🏻

I have just updated my Semantic-release config to the same as yours and it works as expected ...

I am running this in GitHub Actions

  • Node: 22.14.0
  • semantic-release version: 23.1.1
  • semantic-release-replace-plugin: 1.2.7

Hopping it will help you 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants