Fix "full tag" match pattern

This commit is contained in:
Paul Hatcherian 2021-02-25 08:51:40 -05:00
parent d061f3fb0e
commit ed818a75eb
3 changed files with 17 additions and 2 deletions

2
dist/index.js vendored
View file

@ -1139,7 +1139,7 @@ async function run() {
branch = (await cmd('git', 'rev-parse', 'HEAD')).trim(); branch = (await cmd('git', 'rev-parse', 'HEAD')).trim();
} }
const versionPattern = shortTags ? '*[0-9.]' : '[0-9]+\\.[0-9]+\\.[0-9]+' const versionPattern = shortTags ? '*[0-9.]' : '*[0-9].*[0-9].*[0-9]'
const releasePattern = namespace === '' ? `${tagPrefix}${versionPattern}` : `${tagPrefix}${versionPattern}-${namespace}`; const releasePattern = namespace === '' ? `${tagPrefix}${versionPattern}` : `${tagPrefix}${versionPattern}-${namespace}`;
let major = 0, minor = 0, patch = 0, increment = 0; let major = 0, minor = 0, patch = 0, increment = 0;
let changed = true; let changed = true;

View file

@ -118,7 +118,7 @@ async function run() {
branch = (await cmd('git', 'rev-parse', 'HEAD')).trim(); branch = (await cmd('git', 'rev-parse', 'HEAD')).trim();
} }
const versionPattern = shortTags ? '*[0-9.]' : '[0-9]+\\.[0-9]+\\.[0-9]+' const versionPattern = shortTags ? '*[0-9.]' : '*[0-9].*[0-9].*[0-9]'
const releasePattern = namespace === '' ? `${tagPrefix}${versionPattern}` : `${tagPrefix}${versionPattern}-${namespace}`; const releasePattern = namespace === '' ? `${tagPrefix}${versionPattern}` : `${tagPrefix}${versionPattern}-${namespace}`;
let major = 0, minor = 0, patch = 0, increment = 0; let major = 0, minor = 0, patch = 0, increment = 0;
let changed = true; let changed = true;

View file

@ -549,5 +549,20 @@ test('Regular expressions can be used as minor tag', () => {
repo.makeCommit('Second Commit SomeValue'); // 0.0.1+1 repo.makeCommit('Second Commit SomeValue'); // 0.0.1+1
expect(repo.runAction()).toMatch('Version is 0.1.0+0'); expect(repo.runAction()).toMatch('Version is 0.1.0+0');
repo.clean();
});
test('Short tags disabled matches full tags', () => {
const repo = createTestRepo({ short_tags: 'false' }); // 0.0.0
repo.makeCommit('Initial Commit');
repo.makeCommit('Second Commit');
repo.makeCommit('Third Commit');
repo.exec('git tag v1.2.3');
const result = repo.runAction();
expect(result).toMatch('Version is 1.2.3+0');
repo.clean(); repo.clean();
}); });