diff --git a/lib/modules/versioning/composer/index.spec.ts b/lib/modules/versioning/composer/index.spec.ts index 56820f37fa2518292fa1dc8cbd777a0e948c108c..4df706a9886f8f33574693d717862c4e96bb8110 100644 --- a/lib/modules/versioning/composer/index.spec.ts +++ b/lib/modules/versioning/composer/index.spec.ts @@ -113,7 +113,8 @@ describe('modules/versioning/composer/index', () => { ${'~1.0'} | ${'pin'} | ${'1.0'} | ${'V1.1'} | ${'V1.1'} ${'^1.0'} | ${'pin'} | ${'1.0'} | ${'V1.1'} | ${'V1.1'} ${'v1.0'} | ${'replace'} | ${'1.0'} | ${'1.1'} | ${'v1.1'} - ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0'} + ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0.7'} + ${'^9.4'} | ${'bump'} | ${'9.4.3'} | ${'9.4.8'} | ${'^9.4.8'} ${'<2.7.14'} | ${'bump'} | ${'2.0.3'} | ${'2.0.4'} | ${'<2.7.14'} ${'^1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.3.5'} | ${'^1.3.5'} ${'^1'} | ${'replace'} | ${'1.0.0'} | ${'1.3.5'} | ${'^1'} diff --git a/lib/modules/versioning/composer/index.ts b/lib/modules/versioning/composer/index.ts index 56fe9d1f416527d8bb8521077f2997677635c3af..cad5fabfe83e21b1c7c95ce76bfb5dd6588e73ca 100644 --- a/lib/modules/versioning/composer/index.ts +++ b/lib/modules/versioning/composer/index.ts @@ -204,8 +204,10 @@ function getNewValue({ regEx(/^[~^]([0-9]*(?:\.[0-9]*)?)$/).test(currentValue) ) { const operator = currentValue.substring(0, 1); - // handle ~4.1 case - if ((currentMajor && toMajor > currentMajor) || !toMinor) { + if (rangeStrategy === 'bump') { + newValue = `${operator}${newVersion}`; + } else if ((currentMajor && toMajor > currentMajor) || !toMinor) { + // handle ~4.1 case newValue = `${operator}${toMajor}.0`; } else { newValue = `${operator}${toMajor}.${toMinor}`;