Optum / semver-cli

Apache License 2.0
8 stars 1 forks source link

Add support for different version formats when using regexp #60

Closed rslayman closed 5 months ago

rslayman commented 5 months ago

Adding variant parameter to the regexp post hook. This allows us to configure the version format that is used to replace the pre-existing version.

Current Problem

I am deploying a pre-release build and I have a helm/values.yaml file and I want the value of container.image.tag to be updated to the current docker image version. The current implementation will update the field with a value similar to 0.1.0-pr.0+1 but the + formatted version does not match the supported docker format 0.1.0-pr.0-1.

Solution

Extend current support for version formats (aka variant) to be used by regexp hooks. Add version_default: version to the version.ts variants function, and also add new variantByKey function. that can then be used in the regexp.ts

regexp hook can now be configured using version_dotnet, version_docker, or version_default (the default).

Example version.yaml config using variant

- kind: regexp
  file: helm/values.yaml
  pattern: '(?<=tag: ).*'
  variant: version_docker
CLAassistant commented 5 months ago

CLA assistant check
All committers have signed the CLA.

justinmchase commented 5 months ago

If you run deno fmt locally and push up the changes it will fix all the lint issues automatically.

rslayman commented 5 months ago

Applied changes per PR comments.

justinmchase commented 5 months ago

Fixes #37