mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-06 16:16:54 +00:00
Update tag resolver to use tag order instead of author date
This commit is contained in:
parent
0e3d4652d7
commit
cd16d71443
6 changed files with 126 additions and 13 deletions
|
|
@ -47,7 +47,18 @@ class TagLastReleaseResolver {
|
|||
const [currentMajor, currentMinor, currentPatch] = !!currentTag ? tagFormatter.Parse(currentTag) : [null, null, null];
|
||||
let tag = '';
|
||||
try {
|
||||
tag = (yield (0, CommandRunner_1.cmd)('git', `describe`, `--tags`, `--abbrev=0`, `--match=${releasePattern}`, `${current}~1`)).trim();
|
||||
if (!!currentTag) {
|
||||
// If we already have the current branch tagged, we are checking for the previous one
|
||||
// so that we will have an accurate increment (assuming the new tag is the expected one)
|
||||
const command = `git for-each-ref --count=2 --sort=-v:*refname --format=%(refname:short) --merged=${current} refs/tags/${releasePattern}`;
|
||||
tag = yield (0, CommandRunner_1.cmd)(command);
|
||||
tag = tag.split('\n').at(-1) || '';
|
||||
}
|
||||
else {
|
||||
const command = `git for-each-ref --count=1 --sort=-v:*refname --format=%(refname:short) --merged=${current} refs/tags/${releasePattern}`;
|
||||
tag = yield (0, CommandRunner_1.cmd)(command);
|
||||
}
|
||||
tag = tag.trim();
|
||||
}
|
||||
catch (err) {
|
||||
tag = '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue