mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-09 01:24:17 +00:00
WIP
This commit is contained in:
parent
3d087053c5
commit
62cc2d5a6e
12 changed files with 1488 additions and 1008 deletions
|
|
@ -1,4 +1,27 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
|
@ -15,8 +38,10 @@ const VersionType_1 = require("./providers/VersionType");
|
|||
const UserInfo_1 = require("./providers/UserInfo");
|
||||
const VersionInformation_1 = require("./providers/VersionInformation");
|
||||
const DebugManager_1 = require("./DebugManager");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
function runAction(configurationProvider) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info("VAGO STARTING runAction");
|
||||
const currentCommitResolver = configurationProvider.GetCurrentCommitResolver();
|
||||
const lastReleaseResolver = configurationProvider.GetLastReleaseResolver();
|
||||
const commitsProvider = configurationProvider.GetCommitsProvider();
|
||||
|
|
@ -26,13 +51,20 @@ function runAction(configurationProvider) {
|
|||
const userFormatter = configurationProvider.GetUserFormatter();
|
||||
const debugManager = DebugManager_1.DebugManager.getInstance();
|
||||
if (yield currentCommitResolver.IsEmptyRepoAsync()) {
|
||||
core.info("VAGO REPO WAS EMPTY, returning default version information");
|
||||
const versionInfo = new VersionInformation_1.VersionInformation(0, 0, 0, 0, VersionType_1.VersionType.None, [], false, false);
|
||||
return new VersionResult_1.VersionResult(versionInfo.major, versionInfo.minor, versionInfo.patch, versionInfo.increment, versionInfo.type, versionFormatter.Format(versionInfo), tagFormatter.Format(versionInfo), versionInfo.changed, versionInfo.isTagged, userFormatter.Format('author', []), '', '', tagFormatter.Parse(tagFormatter.Format(versionInfo)).join('.'), debugManager.getDebugOutput(true));
|
||||
}
|
||||
core.info("VAGO REPO IS NOT EMPTY, continuing with versioning");
|
||||
const currentCommit = yield currentCommitResolver.ResolveAsync();
|
||||
core.info("VAGO CURRENT COMMIT: " + currentCommit);
|
||||
const lastRelease = yield lastReleaseResolver.ResolveAsync(currentCommit, tagFormatter);
|
||||
core.info("VAGO LAST RELEASE: " + lastRelease.hash + " " + lastRelease.major + "." + lastRelease.minor + "." + lastRelease.patch);
|
||||
const commitSet = yield commitsProvider.GetCommitsAsync(lastRelease.hash, currentCommit);
|
||||
core.info("VAGO commit set le:" + commitSet.commits.length);
|
||||
core.info("VAGO commit set changed: " + commitSet.changed.toString());
|
||||
const classification = yield versionClassifier.ClassifyAsync(lastRelease, commitSet);
|
||||
core.info("VAGO classification: " + JSON.stringify(classification));
|
||||
const { isTagged } = lastRelease;
|
||||
const { major, minor, patch, increment, type, changed } = classification;
|
||||
// At this point all necessary data has been pulled from the database, create
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ function setOutput(versionResult) {
|
|||
const { major, minor, patch, increment, versionType, formattedVersion, versionTag, changed, isTagged, authors, currentCommit, previousCommit, previousVersion, debugOutput } = versionResult;
|
||||
const repository = process.env.GITHUB_REPOSITORY;
|
||||
if (!changed) {
|
||||
core.info("VAGOOO1");
|
||||
core.info('No changes detected for this commit');
|
||||
}
|
||||
core.info(`Version is ${formattedVersion}`);
|
||||
|
|
@ -64,6 +65,7 @@ function setOutput(versionResult) {
|
|||
}
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info("VAGO Starting run action...");
|
||||
function toBool(value) {
|
||||
if (!value || value.toLowerCase() === 'false') {
|
||||
return false;
|
||||
|
|
@ -113,7 +115,9 @@ function run() {
|
|||
core.warning(`The 'short_tags' input option is no longer supported`);
|
||||
}
|
||||
const configurationProvider = new ConfigurationProvider_1.ConfigurationProvider(config);
|
||||
core.info("VAGO start await runAction(configurationProvider)");
|
||||
const result = yield (0, action_1.runAction)(configurationProvider);
|
||||
core.info("VAGO before setOutput(result)");
|
||||
setOutput(result);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,27 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
|
|
@ -12,6 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
exports.DefaultVersionClassifier = void 0;
|
||||
const VersionClassification_1 = require("./VersionClassification");
|
||||
const VersionType_1 = require("./VersionType");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
class DefaultVersionClassifier {
|
||||
constructor(config) {
|
||||
const searchBody = config.searchCommitBody;
|
||||
|
|
@ -85,9 +109,13 @@ class DefaultVersionClassifier {
|
|||
}
|
||||
ClassifyAsync(lastRelease, commitSet) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info("VAGO DefaultVersionClassifier.ClassifyAsync called");
|
||||
const { type, increment, changed } = this.resolveCommitType(commitSet);
|
||||
core.info("VAGO DefaultVersionClassifier.ClassifyAsync: type: " + VersionType_1.VersionType[type] + ", increment: " + increment + ", changed: " + changed);
|
||||
const { major, minor, patch } = this.getNextVersion(lastRelease, type);
|
||||
core.info("VAGOO DefaultVersionClassifier.ClassifyAsync: major: " + major + ", minor: " + minor + ", patch: " + patch);
|
||||
if (lastRelease.currentPatch !== null) {
|
||||
core.info("VAGO DefaultVersionClassifier.ClassifyAsync: lastRelease.currentPatch is not null, using it to determine version classification");
|
||||
// If the current commit is tagged, we must use that version. Here we check if the version we have resolved from the
|
||||
// previous commits is the same as the current version. If it is, we will use the increment value, otherwise we reset
|
||||
// to zero. For example:
|
||||
|
|
@ -97,6 +125,10 @@ class DefaultVersionClassifier {
|
|||
// - commit 4 - v2.0.1+0
|
||||
const versionsMatch = lastRelease.currentMajor === major && lastRelease.currentMinor === minor && lastRelease.currentPatch === patch;
|
||||
const currentIncrement = versionsMatch ? increment : 0;
|
||||
core.info("VAGO DefaultVersionClassifier.ClassifyAsync: versionsMatch: " + versionsMatch + ", currentIncrement: " + currentIncrement);
|
||||
core.info("VAGO DefaultVersionClassifier.ClassifyAsync: lastRelease.currentMajor: " + lastRelease.currentMajor);
|
||||
core.info("VAGO DefaultVersionClassifier.ClassifyAsync: lastRelease.currentMinor: " + lastRelease.currentMinor);
|
||||
core.info("VAGO DefaultVersionClassifier.ClassifyAsync: lastRelease.currentPatch: " + lastRelease.currentPatch);
|
||||
return new VersionClassification_1.VersionClassification(VersionType_1.VersionType.None, currentIncrement, false, lastRelease.currentMajor, lastRelease.currentMinor, lastRelease.currentPatch);
|
||||
}
|
||||
return new VersionClassification_1.VersionClassification(type, increment, changed, major, minor, patch);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue