mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2025-12-27 13:08:17 +00:00
Fix output mapping
This commit is contained in:
parent
d160cb59d5
commit
ea50fff3e4
8 changed files with 26 additions and 11 deletions
|
|
@ -73,6 +73,13 @@ outputs:
|
||||||
description: "Indicates whether there was a change since the last version if change_path was specified. If no change_path was specified this value will always be true since the entire repo is considered."
|
description: "Indicates whether there was a change since the last version if change_path was specified. If no change_path was specified this value will always be true since the entire repo is considered."
|
||||||
authors:
|
authors:
|
||||||
description: "List of users contributing commits to this version"
|
description: "List of users contributing commits to this version"
|
||||||
|
previous_commit:
|
||||||
|
description: "Hash of the previous commit"
|
||||||
|
previous_version:
|
||||||
|
description: "Indicates the previous version"
|
||||||
|
current_commit:
|
||||||
|
description: "The current commit hash"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "node16"
|
using: "node16"
|
||||||
main: "dist/index.js"
|
main: "dist/index.js"
|
||||||
12
dist/index.js
vendored
12
dist/index.js
vendored
|
|
@ -136,7 +136,7 @@ class VersionResult {
|
||||||
* @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.)
|
* @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.)
|
||||||
* @param currentCommit - The current commit hash
|
* @param currentCommit - The current commit hash
|
||||||
* @param previousCommit - The previous commit hash
|
* @param previousCommit - The previous commit hash
|
||||||
* @param previousVersion - the previous version
|
* @param previousVersion - The previous version
|
||||||
*/
|
*/
|
||||||
constructor(major, minor, patch, increment, versionType, formattedVersion, versionTag, changed, authors, currentCommit, previousCommit, previousVersion) {
|
constructor(major, minor, patch, increment, versionType, formattedVersion, versionTag, changed, authors, currentCommit, previousCommit, previousVersion) {
|
||||||
this.major = major;
|
this.major = major;
|
||||||
|
|
@ -287,10 +287,14 @@ class DefaultTagFormatter {
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
IsValid(tag) {
|
IsValid(tag) {
|
||||||
|
const regexEscape = (literal) => literal.replace(/\W/g, '\\$&');
|
||||||
|
const tagPrefix = regexEscape(this.tagPrefix);
|
||||||
|
const namespaceSeperator = regexEscape(this.namespaceSeperator);
|
||||||
|
const namespace = regexEscape(this.namespace);
|
||||||
if (!!this.namespace) {
|
if (!!this.namespace) {
|
||||||
return new RegExp(`^${this.tagPrefix}[0-9]+.[0-9]+.[0-9]+${this.namespaceSeperator}${this.namespace}$`).test(tag);
|
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+${namespaceSeperator}${namespace}$`).test(tag);
|
||||||
}
|
}
|
||||||
return new RegExp(`^${this.tagPrefix}[0-9]+.[0-9]+.[0-9]+$`).test(tag);
|
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+$`).test(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.DefaultTagFormatter = DefaultTagFormatter;
|
exports.DefaultTagFormatter = DefaultTagFormatter;
|
||||||
|
|
@ -405,9 +409,9 @@ function setOutput(versionResult) {
|
||||||
core.setOutput("changed", changed.toString());
|
core.setOutput("changed", changed.toString());
|
||||||
core.setOutput("version_tag", versionTag);
|
core.setOutput("version_tag", versionTag);
|
||||||
core.setOutput("authors", authors);
|
core.setOutput("authors", authors);
|
||||||
core.setOutput("lastVersion", authors);
|
|
||||||
core.setOutput("previous_commit", previousCommit);
|
core.setOutput("previous_commit", previousCommit);
|
||||||
core.setOutput("previous_version", previousVersion);
|
core.setOutput("previous_version", previousVersion);
|
||||||
|
core.setOutput("current_commit", currentCommit);
|
||||||
}
|
}
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
|
|
||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -16,7 +16,7 @@ class VersionResult {
|
||||||
* @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.)
|
* @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.)
|
||||||
* @param currentCommit - The current commit hash
|
* @param currentCommit - The current commit hash
|
||||||
* @param previousCommit - The previous commit hash
|
* @param previousCommit - The previous commit hash
|
||||||
* @param previousVersion - the previous version
|
* @param previousVersion - The previous version
|
||||||
*/
|
*/
|
||||||
constructor(major, minor, patch, increment, versionType, formattedVersion, versionTag, changed, authors, currentCommit, previousCommit, previousVersion) {
|
constructor(major, minor, patch, increment, versionType, formattedVersion, versionTag, changed, authors, currentCommit, previousCommit, previousVersion) {
|
||||||
this.major = major;
|
this.major = major;
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,14 @@ class DefaultTagFormatter {
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
IsValid(tag) {
|
IsValid(tag) {
|
||||||
|
const regexEscape = (literal) => literal.replace(/\W/g, '\\$&');
|
||||||
|
const tagPrefix = regexEscape(this.tagPrefix);
|
||||||
|
const namespaceSeperator = regexEscape(this.namespaceSeperator);
|
||||||
|
const namespace = regexEscape(this.namespace);
|
||||||
if (!!this.namespace) {
|
if (!!this.namespace) {
|
||||||
return new RegExp(`^${this.tagPrefix}[0-9]+.[0-9]+.[0-9]+${this.namespaceSeperator}${this.namespace}$`).test(tag);
|
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+${namespaceSeperator}${namespace}$`).test(tag);
|
||||||
}
|
}
|
||||||
return new RegExp(`^${this.tagPrefix}[0-9]+.[0-9]+.[0-9]+$`).test(tag);
|
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+$`).test(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.DefaultTagFormatter = DefaultTagFormatter;
|
exports.DefaultTagFormatter = DefaultTagFormatter;
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,9 @@ function setOutput(versionResult) {
|
||||||
core.setOutput("changed", changed.toString());
|
core.setOutput("changed", changed.toString());
|
||||||
core.setOutput("version_tag", versionTag);
|
core.setOutput("version_tag", versionTag);
|
||||||
core.setOutput("authors", authors);
|
core.setOutput("authors", authors);
|
||||||
core.setOutput("lastVersion", authors);
|
|
||||||
core.setOutput("previous_commit", previousCommit);
|
core.setOutput("previous_commit", previousCommit);
|
||||||
core.setOutput("previous_version", previousVersion);
|
core.setOutput("previous_version", previousVersion);
|
||||||
|
core.setOutput("current_commit", currentCommit);
|
||||||
}
|
}
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export class VersionResult {
|
||||||
* @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.)
|
* @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.)
|
||||||
* @param currentCommit - The current commit hash
|
* @param currentCommit - The current commit hash
|
||||||
* @param previousCommit - The previous commit hash
|
* @param previousCommit - The previous commit hash
|
||||||
* @param previousVersion - the previous version
|
* @param previousVersion - The previous version
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
public major: number,
|
public major: number,
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ function setOutput(versionResult: VersionResult) {
|
||||||
core.setOutput("changed", changed.toString());
|
core.setOutput("changed", changed.toString());
|
||||||
core.setOutput("version_tag", versionTag);
|
core.setOutput("version_tag", versionTag);
|
||||||
core.setOutput("authors", authors);
|
core.setOutput("authors", authors);
|
||||||
core.setOutput("lastVersion", authors);
|
|
||||||
core.setOutput("previous_commit", previousCommit);
|
core.setOutput("previous_commit", previousCommit);
|
||||||
core.setOutput("previous_version", previousVersion);
|
core.setOutput("previous_version", previousVersion);
|
||||||
|
core.setOutput("current_commit", currentCommit);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue