allow to match part of the git tag or value for semver type
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
14
src/meta.ts
14
src/meta.ts
@@ -161,8 +161,20 @@ export class Meta {
|
||||
if (tag.attrs['value'].length > 0) {
|
||||
vraw = this.setGlobalExp(tag.attrs['value']);
|
||||
} else {
|
||||
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
vraw = this.context.ref.replace(/^refs\/tags\//g, '');
|
||||
}
|
||||
|
||||
if (tag.attrs['match'].length > 0) {
|
||||
const tmatch = vraw.match(tag.attrs['match']);
|
||||
if (!tmatch) {
|
||||
core.warning(`${tag.attrs['match']} does not match ${vraw}.`);
|
||||
} else {
|
||||
vraw = this.setValue(tmatch[1], tag);
|
||||
}
|
||||
}
|
||||
|
||||
vraw = vraw.replace(/\//g, '-');
|
||||
|
||||
if (!semver.valid(vraw)) {
|
||||
core.warning(`${vraw} is not a valid semver. More info: https://semver.org/`);
|
||||
return version;
|
||||
|
@@ -137,6 +137,9 @@ export function Parse(s: string): Tag {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'value')) {
|
||||
tag.attrs['value'] = '';
|
||||
}
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'match')) {
|
||||
tag.attrs['match'] = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type.Match: {
|
||||
|
Reference in New Issue
Block a user