mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-09 09:34:18 +00:00
Preserve increment value on already tagged commits
This commit is contained in:
parent
fada5c116a
commit
9e192e115f
3 changed files with 41 additions and 15 deletions
21
dist/index.js
vendored
21
dist/index.js
vendored
|
|
@ -1141,12 +1141,6 @@ async function run() {
|
|||
`git tag --points-at ${branch} ${releasePattern}`
|
||||
)).trim();
|
||||
|
||||
if (currentTag) {
|
||||
[major, minor, patch] = parseVersion(currentTag);
|
||||
setOutput(major, minor, patch, 0, false, branch, namespace);
|
||||
return;
|
||||
}
|
||||
|
||||
let tag = '';
|
||||
try {
|
||||
tag = (await cmd(
|
||||
|
|
@ -1203,7 +1197,9 @@ async function run() {
|
|||
if (bumpEachCommit) {
|
||||
core.info(history)
|
||||
history.forEach(line => {
|
||||
if (line.includes(majorPattern)) {
|
||||
if (currentTag) {
|
||||
[major, minor, patch] = parseVersion(currentTag);
|
||||
} else if (line.includes(majorPattern)) {
|
||||
major += 1;
|
||||
minor = 0;
|
||||
patch = 0;
|
||||
|
|
@ -1214,6 +1210,7 @@ async function run() {
|
|||
patch += 1;
|
||||
}
|
||||
});
|
||||
|
||||
setOutput(major, minor, patch, increment, changed, branch, namespace);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1238,6 +1235,16 @@ async function run() {
|
|||
patch++;
|
||||
}
|
||||
|
||||
if (currentTag) {
|
||||
let tagVersion = parseVersion(currentTag);
|
||||
if (tagVersion[0] !== major &&
|
||||
tagVersion[1] !== minor &&
|
||||
tagVersion[2] !== patch) {
|
||||
[major, minor, patch] = tagVersion;
|
||||
increment = 0;
|
||||
}
|
||||
}
|
||||
|
||||
setOutput(major, minor, patch, increment, changed, branch, namespace);
|
||||
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue