googleapis / googleapis/release-please
How to add additional versioning strategy types
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 588
- Avg merge
- 12h 16m
- Merged PRs (30d)
- 7
Description
The docs (https://github.com/googleapis/release-please/blob/71dcc7b3b2df4bb3d3e0884b3f0bfb96700cb76a/docs/customizing.md#adding-additional-versioning-strategy-types) mention
> To add a new versioning strategy, create a new class that implements the [VersioningStrategy interface](https://github.com/googleapis/release-please/blob/main/src/versioning-strategy.ts).
But I can't see to find any further instruction on how to do this. I see there is https://github.com/googleapis/release-please/issues/1341 and from the linked PR (disclaimer: not a JS/TS dev so I may be missing something obvious):
* I see there is [`registerVersioningStrategy`](https://github.com/googleapis/release-please/blob/71dcc7b3b2df4bb3d3e0884b3f0bfb96700cb76a/src/index.ts#L49), but how do I have the class loaded in to `release-please`?
* I see we can pass a plugin name to `--plugin` https://github.com/googleapis/release-please/blob/71dcc7b3b2df4bb3d3e0884b3f0bfb96700cb76a/src/bin/release-please.ts#L832C24-L832C24 which will then `require`
So is the process to install a module that runs an `init` like:
```js
function init() {
registerVersioningStrategy('my-cool-versioning-strategy', myVersioningStrategyClass)
}
```
and then run `release-please --versioning-strategy my-cool-versioning-strategy`?
EDIT: I think the above doesn't work because plugins are loaded after versioning strategies, so it errors when trying to find a choice:
```
Invalid values:
Argument: versioning-strategy, Given: "my-cool-versioning-strategy`", Choices: "always-bump-major", "always-bump-minor", "always-bump-patch", "default", "prerelease", "service-pack"
```
Contributor guide
Assessment
This issue has not been assessed yet.