Skip to content

Commit 699ee45

Browse files
committed
allow to match part of the git tag or value for pep440 type
Signed-off-by: CrazyMax <[email protected]>
1 parent e0542a6 commit 699ee45

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/meta.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class Meta {
169169
if (!tmatch) {
170170
core.warning(`${tag.attrs['match']} does not match ${vraw}.`);
171171
} else {
172-
vraw = this.setValue(tmatch[1], tag);
172+
vraw = tmatch[1];
173173
}
174174
}
175175

@@ -207,8 +207,20 @@ export class Meta {
207207
if (tag.attrs['value'].length > 0) {
208208
vraw = this.setGlobalExp(tag.attrs['value']);
209209
} else {
210-
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
210+
vraw = this.context.ref.replace(/^refs\/tags\//g, '');
211+
}
212+
213+
if (tag.attrs['match'].length > 0) {
214+
const tmatch = vraw.match(tag.attrs['match']);
215+
if (!tmatch) {
216+
core.warning(`${tag.attrs['match']} does not match ${vraw}.`);
217+
} else {
218+
vraw = tmatch[1];
219+
}
211220
}
221+
222+
vraw = vraw.replace(/\//g, '-');
223+
212224
if (!pep440.valid(vraw)) {
213225
core.warning(`${vraw} does not conform to PEP 440. More info: https://www.python.org/dev/peps/pep-0440`);
214226
return version;

0 commit comments

Comments
 (0)