fix: make v character in version tags optional (#423)
* fix: make v character in version tags optional * fix: cross platform regex * fix: test regex within grep. * fix: add semantic tags prepended with v
This commit is contained in:
15
dist/index.js
generated
vendored
15
dist/index.js
generated
vendored
@@ -5921,6 +5921,9 @@ class Versioning {
|
||||
static get strategies() {
|
||||
return { None: 'None', Semantic: 'Semantic', Tag: 'Tag', Custom: 'Custom' };
|
||||
}
|
||||
static get grepCompatibleInputVersionRegex() {
|
||||
return '^v?([0-9]+\\.)*[0-9]+.*';
|
||||
}
|
||||
/**
|
||||
* Get the branch name of the (related) branch
|
||||
*/
|
||||
@@ -6158,17 +6161,19 @@ class Versioning {
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Whether or not the repository has any version tags yet.
|
||||
* Whether the current tree has any version tags yet.
|
||||
*
|
||||
* Note: Currently this is run in all OSes, so the syntax must be cross-platform.
|
||||
*/
|
||||
static hasAnyVersionTags() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const numberOfCommitsAsString = yield system_1.default.run('sh', undefined, {
|
||||
input: Buffer.from('git tag --list --merged HEAD | grep v[0-9]* | wc -l'),
|
||||
const numberOfTagsAsString = yield system_1.default.run('sh', undefined, {
|
||||
input: Buffer.from(`git tag --list --merged HEAD | grep -E '${this.grepCompatibleInputVersionRegex}' | wc -l`),
|
||||
cwd: this.projectPath,
|
||||
silent: false,
|
||||
});
|
||||
const numberOfCommits = Number.parseInt(numberOfCommitsAsString, 10);
|
||||
return numberOfCommits !== 0;
|
||||
const numberOfTags = Number.parseInt(numberOfTagsAsString, 10);
|
||||
return numberOfTags !== 0;
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user