Add support to bump the version on each commit (MINOR)

This commit is contained in:
Paul Hatcherian 2020-12-20 10:17:40 -05:00
parent 959e71ff1c
commit 1412b429b4
5 changed files with 85 additions and 1 deletions

19
dist/index.js vendored
View file

@ -1026,6 +1026,7 @@ const eol = '\n';
const tagPrefix = core.getInput('tag_prefix') || '';
const namespace = core.getInput('namespace') || '';
const shortTags = core.getInput('short_tags') === 'true';
const bumpEachCommit = core.getInput('bump_each_commit') === 'true';
const cmd = async (command, ...args) => {
let output = '', errors = '';
@ -1199,6 +1200,24 @@ async function run() {
.split(eol)
.reverse();
if (bumpEachCommit) {
core.info(history)
history.forEach(line => {
if (line.includes(majorPattern)) {
major += 1;
minor = 0;
patch = 0;
} else if (line.includes(minorPattern)) {
minor += 1;
patch = 0;
} else {
patch += 1;
}
});
setOutput(major, minor, patch, increment, changed, branch, namespace);
return;
}
// Discover the change time from the history log by finding the oldest log
// that could set the version.