feat!: tag released

This commit is contained in:
marcin 2023-03-28 16:34:14 +01:00
parent f9d3daa396
commit 0735972145
No known key found for this signature in database
GPG key ID: 524860A885021BCB
33 changed files with 216 additions and 42 deletions

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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`);