Skip to content

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

@hcsaustrup

Description

@hcsaustrup

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions