diff --git a/dist/index.js b/dist/index.js index 3d1cfee..d53aa5a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -8772,7 +8772,7 @@ var __webpack_exports__ = {}; const bump = (version, bump) => { - const cleanVersionMatcher = version.match(/.*(\d+\.\d+\.\d+).*/); + const cleanVersionMatcher = version.match(/[^\d]*((\d+)\.(\d+)\.(\d+)).*/); if (cleanVersionMatcher == null || cleanVersionMatcher[1] === null) { throw new Error(`invalid semver: ${version}`); } diff --git a/src/bump.spec.ts b/src/bump.spec.ts index e1bda33..8bf2081 100644 --- a/src/bump.spec.ts +++ b/src/bump.spec.ts @@ -5,6 +5,7 @@ describe('bump', () => { expect(bump('1.2.3', 'patch')).toEqual('1.2.4') expect(bump('1.2.3', 'minor')).toEqual('1.3.0') expect(bump('1.2.3', 'major')).toEqual('2.0.0') + expect(bump('101.2.2', 'patch')).toEqual('101.2.3') expect(bump('v1.2.3', 'major')).toEqual('2.0.0') expect(bump('v1.2.3', 'minor')).toEqual('1.3.0') expect(bump('v1.2.3--alpha3', 'minor')).toEqual('1.3.0') diff --git a/src/bump.ts b/src/bump.ts index 7cb7205..48b41a3 100644 --- a/src/bump.ts +++ b/src/bump.ts @@ -3,7 +3,7 @@ import {CommitMessageQueryResponse, MergeCommit} from "./QueryTypes"; export type Bump = 'major' | 'minor' | 'patch'; export const bump = (version: string, bump: Bump) => { - const cleanVersionMatcher = version.match(/.*(\d+\.\d+\.\d+).*/); + const cleanVersionMatcher = version.match(/[^\d]*((\d+)\.(\d+)\.(\d+)).*/); if (cleanVersionMatcher == null || cleanVersionMatcher[1] === null) { throw new Error(`invalid semver: ${version}`) }