2
0
Fork 0
mirror of https://code.forgejo.org/docker/metadata-action.git synced 2025-08-12 00:50:53 +00:00

allow to match part of the git tag or value for pep440 type

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2025-08-01 10:50:51 +02:00
parent e0542a6360
commit 699ee45cf1
No known key found for this signature in database
GPG key ID: ADE44D8C9D44FBE4

View file

@ -169,7 +169,7 @@ export class Meta {
if (!tmatch) {
core.warning(`${tag.attrs['match']} does not match ${vraw}.`);
} else {
vraw = this.setValue(tmatch[1], tag);
vraw = tmatch[1];
}
}
@ -207,8 +207,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 = tmatch[1];
}
}
vraw = vraw.replace(/\//g, '-');
if (!pep440.valid(vraw)) {
core.warning(`${vraw} does not conform to PEP 440. More info: https://www.python.org/dev/peps/pep-0440`);
return version;