mirror of
https://github.com/PaulHatch/semantic-version.git
synced 2026-04-10 01:54:18 +00:00
feat!: tag released
This commit is contained in:
parent
f9d3daa396
commit
0735972145
33 changed files with 216 additions and 42 deletions
|
|
@ -32,6 +32,8 @@ class ActionConfig {
|
|||
this.userFormatType = "csv";
|
||||
/** Prevents pre-v1.0.0 version from automatically incrementing the major version. If enabled, when the major version is 0, major releases will be treated as minor and minor as patch. Note that the versionType output is unchanged. */
|
||||
this.enablePrereleaseMode = false;
|
||||
/** Prerelease name. If set, the version will be suffixed with the prerelease name and increment. */
|
||||
this.prereleaseName = "";
|
||||
}
|
||||
}
|
||||
exports.ActionConfig = ActionConfig;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class DefaultTagFormatter {
|
|||
this.namespace = config.namespace;
|
||||
this.tagPrefix = config.tagPrefix;
|
||||
this.namespaceSeperator = '-'; // maybe make configurable in the future
|
||||
this.prereleaseName = config.prereleaseName;
|
||||
}
|
||||
Format(versionInfo) {
|
||||
const result = `${this.tagPrefix}${versionInfo.major}.${versionInfo.minor}.${versionInfo.patch}`;
|
||||
|
|
@ -19,6 +20,9 @@ class DefaultTagFormatter {
|
|||
if (!!this.namespace) {
|
||||
return `${this.tagPrefix}*[0-9].*[0-9].*[0-9]${this.namespaceSeperator}${this.namespace}`;
|
||||
}
|
||||
if (!!this.prereleaseName) {
|
||||
return `${this.tagPrefix}*[0-9].*[0-9].*[0-9]-${this.prereleaseName}.*[0-9]`;
|
||||
}
|
||||
return `${this.tagPrefix}*[0-9].*[0-9].*[0-9]`;
|
||||
}
|
||||
Parse(tag) {
|
||||
|
|
@ -50,6 +54,9 @@ class DefaultTagFormatter {
|
|||
if (!!this.namespace) {
|
||||
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+${namespaceSeperator}${namespace}$`).test(tag);
|
||||
}
|
||||
if (!!this.prereleaseName) {
|
||||
return new RegExp(`^${this.tagPrefix}[0-9]+\.[0-9]+\.[0-9]+-${this.prereleaseName}\.[0-9]+$`).test(tag);
|
||||
}
|
||||
return new RegExp(`^${tagPrefix}[0-9]+\.[0-9]+\.[0-9]+$`).test(tag);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ function run() {
|
|||
searchCommitBody: core.getInput('search_commit_body') === 'true',
|
||||
userFormatType: core.getInput('user_format_type'),
|
||||
enablePrereleaseMode: core.getInput('enable_prerelease_mode') === 'true',
|
||||
prereleaseName: core.getInput('prerelease_name'),
|
||||
};
|
||||
if (config.versionFormat === '' && core.getInput('format') !== '') {
|
||||
core.warning(`The 'format' input is deprecated, use 'versionFormat' instead`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue