Merge pull request #537 from crazy-max/pep440-match
Some checks failed
ci / context (git) (push) Failing after 1s
ci / tag-schedule () (push) Failing after 1s
ci / tag-schedule ({{date 'YYYYMMDD-HHmmss'}}) (push) Failing after 1s
ci / tag-match (\d.\d, 0) (push) Failing after 1s
ci / tag-match (v(.*), 1) (push) Failing after 1s
ci / tag-semver (auto) (push) Failing after 1s
ci / tag-semver (true) (push) Failing after 1s
ci / flavor (push) Failing after 1s
ci / custom-labels-annotations (push) Failing after 1s
ci / global-exps (push) Failing after 1s
ci / bake (push) Failing after 1s
ci / sep-tags (,) (push) Failing after 1s
ci / sep-tags ( ) (push) Failing after 3s
ci / no-output-env (push) Failing after 1s
ci / bake-annotations (push) Failing after 3s
ci / bake-path-context (push) Failing after 1s
ci / sha-short (16) (push) Failing after 1s
ci / dump (push) Failing after 3s
test / test (push) Failing after 1s
ci / docker-push (push) Failing after 15s
validate / prepare (push) Failing after 3s
validate / validate (push) Has been skipped
ci / output-env (push) Failing after 1m15s
ci / context (workflow) (push) Has been cancelled
ci / multi-images (push) Has been cancelled
ci / tag-schedule (cron-{{date 'YYYYMMDD'}}) (push) Has been cancelled
ci / tag-schedule (schedule) (push) Has been cancelled
ci / tag-match (\d.\d.\d, 0) (push) Has been cancelled
ci / tag-semver (false) (push) Has been cancelled
ci / images (push) Has been cancelled
ci / json (push) Has been cancelled
ci / no-images (push) Has been cancelled
ci / sha-short () (push) Has been cancelled

allow to match part of the git tag or value for pep440 type
This commit is contained in:
CrazyMax 2025-08-01 10:56:28 +02:00 committed by GitHub
commit c1e51972af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

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