mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-16 20:09:52 +00:00
Adding is_tagged to outputs
Sets a flag when the current commit that the action is being run on has a tag matching the version format
This commit is contained in:
parent
9e89a29a4a
commit
e27fda7711
17 changed files with 85 additions and 29 deletions
|
|
@ -46,6 +46,7 @@ class DefaultLastReleaseResolver {
|
|||
const releasePattern = tagFormatter.GetPattern();
|
||||
let currentTag = (yield (0, CommandRunner_1.cmd)(`git tag --points-at ${current} ${releasePattern}`)).trim();
|
||||
currentTag = tagFormatter.IsValid(currentTag) ? currentTag : '';
|
||||
const isTagged = currentTag !== '';
|
||||
const [currentMajor, currentMinor, currentPatch] = !!currentTag ? tagFormatter.Parse(currentTag) : [null, null, null];
|
||||
let tag = '';
|
||||
try {
|
||||
|
|
@ -80,12 +81,12 @@ class DefaultLastReleaseResolver {
|
|||
core.warning('No tags are present for this repository. If this is unexpected, check to ensure that tags have been pulled from the remote.');
|
||||
}
|
||||
// no release tags yet, use the initial commit as the root
|
||||
return new ReleaseInformation_1.ReleaseInformation(0, 0, 0, '', currentMajor, currentMinor, currentPatch);
|
||||
return new ReleaseInformation_1.ReleaseInformation(0, 0, 0, '', currentMajor, currentMinor, currentPatch, isTagged);
|
||||
}
|
||||
// parse the version tag
|
||||
const [major, minor, patch] = tagFormatter.Parse(tag);
|
||||
const root = yield (0, CommandRunner_1.cmd)('git', `merge-base`, tag, current);
|
||||
return new ReleaseInformation_1.ReleaseInformation(major, minor, patch, root.trim(), currentMajor, currentMinor, currentPatch);
|
||||
return new ReleaseInformation_1.ReleaseInformation(major, minor, patch, root.trim(), currentMajor, currentMinor, currentPatch, isTagged);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ class ReleaseInformation {
|
|||
* @param currentMajor - the major version number from the current commit
|
||||
* @param currentMinor - the minor version number from the current commit
|
||||
* @param currentPatch - the patch version number from the current commit
|
||||
* @param isTagged - whether the current commit is tagged with a version
|
||||
*/
|
||||
constructor(major, minor, patch, hash, currentMajor, currentMinor, currentPatch) {
|
||||
constructor(major, minor, patch, hash, currentMajor, currentMinor, currentPatch, isTagged) {
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
|
|
@ -21,6 +22,7 @@ class ReleaseInformation {
|
|||
this.currentMajor = currentMajor;
|
||||
this.currentMinor = currentMinor;
|
||||
this.currentPatch = currentPatch;
|
||||
this.isTagged = isTagged;
|
||||
}
|
||||
}
|
||||
exports.ReleaseInformation = ReleaseInformation;
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@ class VersionInformation {
|
|||
* @param type - The type of change the current range represents
|
||||
* @param commits - The list of commits for this version
|
||||
* @param changed - True if the version has changed, false otherwise
|
||||
* @param isTagged - True if the current commit is a version-tagged commit
|
||||
*/
|
||||
constructor(major, minor, patch, increment, type, commits, changed) {
|
||||
constructor(major, minor, patch, increment, type, commits, changed, isTagged) {
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
|
|
@ -24,6 +25,7 @@ class VersionInformation {
|
|||
this.type = type;
|
||||
this.commits = commits;
|
||||
this.changed = changed;
|
||||
this.isTagged = isTagged;
|
||||
}
|
||||
}
|
||||
exports.VersionInformation = VersionInformation;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue