c4urself / bump2version

Version-bump your software with a single command
https://pypi.python.org/pypi/bump2version
MIT License
1.05k stars 135 forks source link

[question] Change only part of the version in a file #243

Open 1oglop1 opened 2 years ago

1oglop1 commented 2 years ago

Hi, I have a library that depends on pulumi but I'd like to version that library separately from the dependency. On top of that I use gitlab CI where I need to update pulumi version so I though that bumpversion can help me with this. Let's call my library components

my setup looks like this: pyproject.toml

version = "1.0.1+pulumi.3.24.1"

.gitlab-ci.yml

variables:
  PYTHON_IMAGE: python:3.8-slim
  PULUMI_VERSION: 3.24.1

IIUC I may be able to use independent = True but I've been playing with the bump2version for 30 minutes so I'm pretty new to this. I'd like to be able to increment the 1.0.1 part normally and every now and then change the pulumi version. Can bumpversion help me with this?

I took an example and made a regex (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)([-](?P<release>(dev|rc))+(?P<build>\d+))?\+pulumi\.(?P<pulumi>\d+\.\d+\.\d+).

Here is what I'd like to achieve:

  1. bumpversion minor -> 1.0.1+pulumi.3.24.1 -> 1.1.0+pulumi.3.24.1 - this would update pyproject.toml
  2. bumpversion pulumi 3.25.0 -> 1.1.0+pulumi.3.25.0 - this would update both pyproject.toml + .gitlab-ci.yml

Thank you