googleapis / googleapis/release-please

Support custom regex for x-release-please-* annotations in extra-files

Open
#2,345 0 comments 0 reactions 1 assignee Claimed by @chingor13 View on GitHub
priority: p3 type: feature request
Dominant language
TypeScript
Stars
7.5k
Forks
588
Avg merge
12h 16m
Merged PRs (30d)
7

Description

Currently, the [version updater](https://github.com/googleapis/release-please/blob/main/docs/customizing.md#updating-arbitrary-files) in extra-files allows us to specify an inline line to update (with `x-release-please-*`) or a block of lines (with `x-release-please-start-*`).

However, within the block of lines it replaces any string that looks like a version number.

I have a fenced code block that provides sample code for installing my library (Google-maps-iOS-Utils) alongside a related dependency (GoogleMaps). I want release-please to update the dependency for my library without updating the version number of the other dependency.

When I try marking the code block, release-please updates every version number in the code block.

**Input code**

```markdown

```ruby
use_frameworks!

target 'TARGET_NAME' do
pod 'GoogleMaps', '8.0.0'
pod 'Google-Maps-iOS-Utils', '4.2.2'
end
\```

```

**Output (see [automated commit](https://github.com/googlemaps/google-maps-ios-utils/pull/476/commits/07987a3332756a7c1ce79d003ef9574d5757e506#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5) in the Release PR)**



use_frameworks!

target 'TARGET_NAME' do
pod 'GoogleMaps', '5.0.0'
pod 'Google-Maps-iOS-Utils', '5.0.0'
end

When I try marking the single line with an inline comment, release-please actually ignores that whole code block and updates *other* version numbers in other parts of the file.

**Input code**

```ruby
use_frameworks!

target 'TARGET_NAME' do
pod 'GoogleMaps', '9.0.0'
pod 'Google-Maps-iOS-Utils', '5.0.0' # x-release-please-version
end
```

**Output (see [automated commit](https://github.com/googlemaps/google-maps-ios-utils/pull/480/commits/b1483563f7dd946905ceca9829fb8d70c389a85c#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5) in the Release PR)**

_no change_



use_frameworks!

target 'TARGET_NAME' do
pod 'GoogleMaps', '9.0.0'
pod 'Google-Maps-iOS-Utils', '5.0.0' # x-release-please-version
end


...
_changed without any annotation_


- github "googlemaps/google-maps-ios-utils" ~> 4.1.0
+ github "googlemaps/google-maps-ios-utils" ~> 6.0.0

## Proposal

- Support more fine-grained definition of the string pattern to replace by accepting a regex parameter instead of the default regex pattern that looks for any major.minor.patch version number string. Perhaps something like the [semantic-release-replace-plugin](https://github.com/jpoehnelt/semantic-release-replace-plugin) to accept a filename and a regex pattern. [Example usage](https://github.com/googlemaps/google-maps-ios-utils/blob/b56b39cec0e3d5938ddadbfeb4d3fec541ebbb5e/.releaserc#L6-L31) in a release config file before we migrated to release-please.

## Alternatives

- Perhaps the second case (inline annotation within a code block) is behaving in an unexpected way due to a bug, and fixing the bug will satisfy my needs by supporting inline annotations within a code block.
- Support specifying a line number(s) instead of relying on code comment to identify which lines to search in.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.