python-semantic-release icon indicating copy to clipboard operation
python-semantic-release copied to clipboard

Updating version_variables that follow tag_format

Open fk128 opened this issue 1 year ago • 3 comments

Hi,

Is it possible to update mentions of the version in files set in version_variables that follow tag_format?

I'm using kustomize for deployments on kubernetes, and I want to be able to update the docker image tag on release. The issue is that, in the yaml file, the tag uses the v prefix, as defined in tag_format.

For instance, the following does not work to update the yaml file because semantic release is not looking for the tag_format pattern

[tool.semantic_release]
tag_format = "v{version}"
version_variables = ["api/app/__init__.py:__version__",
    "manifests/overlays/prod/kustomization.yaml:newTag"]
# kustomization.yaml
images:
  - name: repo/image
    newTag: "v0.1.0"

It only seems to work to get semantic release to update the yaml file if I remove the v prefix, like so

# kustomization.yaml
images:
  - name: repo/image
    newTag: "0.1.0"

but then that wouldn't work, since the actual docker image tag has v as per tag_format.

Is this something that could be solved, perhaps by getting the version replacement to also look for tag_format?

Thanks.

fk128 avatar Feb 23 '24 16:02 fk128