diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index a0a8e74d29dc863bfe694724ef98ca162d4fa735..d244610892a92517d4740e41c7867e8fe1e10b51 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -320,7 +320,7 @@ Currently this setting supports `helmv3`, `npm`, `maven` and `sbt` only, so rais Its purpose is if you want Renovate to update the `version` field within your package file any time it updates dependencies within. Usually this is for automatic release purposes, so that you don't need to add another step after Renovate before you can release a new version. -Configure this value to `"patch"`, `"minor"` or `"major"` to have Renovate update the version in your edited package file. +Configure this value to `"prerelease"`, `"patch"`, `"minor"` or `"major"` to have Renovate update the version in your edited package file. e.g. if you wish Renovate to always increase the target `package.json` version with a patch update, configure this to `"patch"`. For `npm` only you can also configure this field to `"mirror:x"` where `x` is the name of a package in the `package.json`. diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index e9c2c29b8a84d1501a32c212122f2a64cb1aae60..a5b945ad1ce9dac8542d23b3389709f1696c831b 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -1250,7 +1250,7 @@ const options: RenovateOptions[] = [ name: 'bumpVersion', description: 'Bump the version in the package file being updated.', type: 'string', - allowedValues: ['major', 'minor', 'patch'], + allowedValues: ['major', 'minor', 'patch', 'prerelease'], supportedManagers: ['helmv3', 'npm', 'maven', 'sbt'], }, // Major/Minor/Patch diff --git a/lib/modules/manager/maven/__fixtures__/prerelease.pom.xml b/lib/modules/manager/maven/__fixtures__/prerelease.pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..456a22e1e24e2f0d34a389f23e9c260716557f27 --- /dev/null +++ b/lib/modules/manager/maven/__fixtures__/prerelease.pom.xml @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>com.mycompany.app</groupId> + <artifactId>my-app</artifactId> + <version>1.0.0-1</version> +</project> \ No newline at end of file diff --git a/lib/modules/manager/maven/update.spec.ts b/lib/modules/manager/maven/update.spec.ts index dbe881f8d9260b168fb47ea6cccdc3023e45f799..6e735018fe466824f1acb02af70143a58f0a535b 100644 --- a/lib/modules/manager/maven/update.spec.ts +++ b/lib/modules/manager/maven/update.spec.ts @@ -5,6 +5,7 @@ import * as pomUpdater from '.'; const simpleContent = Fixtures.get(`simple.pom.xml`); const minimumContent = Fixtures.get(`minimum.pom.xml`); +const prereleaseContent = Fixtures.get(`prerelease.pom.xml`); describe('modules/manager/maven/update', () => { describe('bumpPackageVersion', () => { @@ -63,5 +64,16 @@ describe('modules/manager/maven/update', () => { ); expect(bumpedContent).toEqual(simpleContent); }); + + it('bumps pom.xml version with prerelease semver level', () => { + const { bumpedContent } = pomUpdater.bumpPackageVersion( + prereleaseContent, + '1.0.0-1', + 'prerelease' + ); + + const project = new XmlDocument(bumpedContent!); + expect(project.valueWithPath('version')).toBe('1.0.0-2'); + }); }); });