Skip to content

Commit

Permalink
feat(bumpVersion): add prerelease semver level (#15626)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrossx2 committed Jun 25, 2022
1 parent 9f01954 commit 1f77816
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/modules/manager/maven/__fixtures__/prerelease.pom.xml
Original file line number Diff line number Diff line change
@@ -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>
12 changes: 12 additions & 0 deletions lib/modules/manager/maven/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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');
});
});
});

0 comments on commit 1f77816

Please sign in to comment.