PEP 440 support

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-07-06 13:56:48 +02:00
parent 8a0bc9fddd
commit a1770d2eba
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
14 changed files with 10946 additions and 6 deletions

View file

@ -23,6 +23,7 @@ ___
* [`tags` input](#tags-input) * [`tags` input](#tags-input)
* [`type=schedule`](#typeschedule) * [`type=schedule`](#typeschedule)
* [`type=semver`](#typesemver) * [`type=semver`](#typesemver)
* [`type=pep440`](#typepep440)
* [`type=match`](#typematch) * [`type=match`](#typematch)
* [`type=edge`](#typeedge) * [`type=edge`](#typeedge)
* [`type=ref`](#typeref) * [`type=ref`](#typeref)
@ -384,11 +385,11 @@ tags: |
``` ```
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push) Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
and requires a valid Git tag [semver](https://semver.org/) but you can also use a custom value through `value` and requires a valid [semver](https://semver.org/) Git tag, but you can also use a custom value through `value`
attribute. attribute.
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions: `pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
* `raw` ; the actual semver * `raw` ; the actual tag
* `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release) * `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release)
* `major` ; major version identifier * `major` ; major version identifier
* `minor` ; minor version identifier * `minor` ; minor version identifier
@ -416,6 +417,51 @@ tags: |
type=semver,enable=true,priority=900,prefix=,suffix=,pattern=,value= type=semver,enable=true,priority=900,prefix=,suffix=,pattern=,value=
``` ```
### `type=pep440`
```yaml
tags: |
# minimal
type=pep440,pattern={{version}}
# use custom value instead of git tag
type=pep440,pattern={{version}},value=1.0.0
```
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push)
and requires a Git tag that conforms to [PEP 440](https://www.python.org/dev/peps/pep-0440/), but you can also use a
custom value through `value` attribute.
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
* `raw` ; the actual tag
* `version` ; cleaned version
* `major` ; major version identifier
* `minor` ; minor version identifier
* `patch` ; patch version identifier
| Git tag | Pattern | Output |
|--------------------|----------------------------------------------------------|----------------------|
| `1.2.3` | `{{raw}}` | `1.2.3` |
| `1.2.3` | `{{version}}` | `1.2.3` |
| `v1.2.3` | `{{version}}` | `1.2.3` |
| `1.2.3` | `{{major}}.{{minor}}` | `1.2` |
| `1.2.3` | `v{{major}}` | `v1` |
| `1.2.3rc2` | `{{raw}}` | `1.2.3rc2`* |
| `1.2.3rc2` | `{{version}}` | `1.2.3rc2` |
| `1.2.3rc2` | `{{major}}.{{minor}}` | `1.2.3rc2`* |
| `1.2.3post1` | `{{major}}.{{minor}}` | `1.2.3.post1`* |
| `1.2.3beta2` | `{{major}}.{{minor}}` | `1.2.3b2`* |
| `1.0dev4` | `{{major}}.{{minor}}` | `1.0.dev4`* |
> *dev/pre/post release will only extend `{{version}}` as tag because they are updated frequently,
> and contain many breaking changes that are (by the author's design) not yet fit for public consumption.
Extended attributes and default values:
```yaml
tags: |
type=pep440,enable=true,priority=900,prefix=,suffix=,pattern=,value=
```
### `type=match` ### `type=match`
```yaml ```yaml

View file

@ -0,0 +1,23 @@
GITHUB_ACTION=crazy-maxghaction-dump-context
GITHUB_ACTIONS=true
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
GITHUB_ACTOR=crazy-max
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_EVENT_NAME=push
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=event
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_REF=refs/tags/1.0dev4
GITHUB_REPOSITORY=crazy-max/test-docker-action
GITHUB_REPOSITORY_OWNER=crazy-max
GITHUB_RETENTION_DAYS=90
GITHUB_RUN_ID=325968230
GITHUB_RUN_NUMBER=4
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
GITHUB_WORKFLOW=event
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action

View file

@ -0,0 +1,23 @@
GITHUB_ACTION=crazy-maxghaction-dump-context
GITHUB_ACTIONS=true
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
GITHUB_ACTOR=crazy-max
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_EVENT_NAME=push
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=event
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_REF=refs/tags/1.1beta2
GITHUB_REPOSITORY=crazy-max/test-docker-action
GITHUB_REPOSITORY_OWNER=crazy-max
GITHUB_RETENTION_DAYS=90
GITHUB_RUN_ID=325968230
GITHUB_RUN_NUMBER=4
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
GITHUB_WORKFLOW=event
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action

View file

@ -0,0 +1,23 @@
GITHUB_ACTION=crazy-maxghaction-dump-context
GITHUB_ACTIONS=true
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
GITHUB_ACTOR=crazy-max
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_EVENT_NAME=push
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=event
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_REF=refs/tags/1.2.3rc2
GITHUB_REPOSITORY=crazy-max/test-docker-action
GITHUB_REPOSITORY_OWNER=crazy-max
GITHUB_RETENTION_DAYS=90
GITHUB_RUN_ID=325968230
GITHUB_RUN_NUMBER=4
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
GITHUB_WORKFLOW=event
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action

View file

@ -0,0 +1,23 @@
GITHUB_ACTION=crazy-maxghaction-dump-context
GITHUB_ACTIONS=true
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
GITHUB_ACTOR=crazy-max
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_EVENT_NAME=push
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=event
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_REF=refs/tags/1.2
GITHUB_REPOSITORY=crazy-max/test-docker-action
GITHUB_REPOSITORY_OWNER=crazy-max
GITHUB_RETENTION_DAYS=90
GITHUB_RUN_ID=325968230
GITHUB_RUN_NUMBER=4
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
GITHUB_WORKFLOW=event
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action

View file

@ -0,0 +1,23 @@
GITHUB_ACTION=crazy-maxghaction-dump-context
GITHUB_ACTIONS=true
GITHUB_ACTION_PATH=/home/runner/work/_actions/crazy-max/ghaction-dump-context/v1
GITHUB_ACTOR=crazy-max
GITHUB_API_URL=https://api.github.com
GITHUB_BASE_REF=
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_EVENT_NAME=push
#GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
GITHUB_HEAD_REF=
GITHUB_JOB=event
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_6ee180c2-b331-434a-a867-89534cbefd83
GITHUB_REF=refs/tags/1.2post1
GITHUB_REPOSITORY=crazy-max/test-docker-action
GITHUB_REPOSITORY_OWNER=crazy-max
GITHUB_RETENTION_DAYS=90
GITHUB_RUN_ID=325968230
GITHUB_RUN_NUMBER=4
GITHUB_SERVER_URL=https://github.com
GITHUB_SHA=90dd6032fac8bda1b6c4436a2e65de27961ed071
GITHUB_WORKFLOW=event
GITHUB_WORKSPACE=/home/runner/work/test-docker-action/test-docker-action

View file

@ -443,6 +443,7 @@ describe('push', () => {
images: ['org/app', 'ghcr.io/user/app'], images: ['org/app', 'ghcr.io/user/app'],
tags: [ tags: [
`type=semver,pattern={{version}}`, `type=semver,pattern={{version}}`,
`type=pep440,pattern={{version}}`,
`type=edge` `type=edge`
], ],
} as Inputs, } as Inputs,
@ -503,6 +504,7 @@ describe('push', () => {
images: ['user/app'], images: ['user/app'],
tags: [ tags: [
`type=semver,pattern={{version}},value=v1.2.3`, `type=semver,pattern={{version}},value=v1.2.3`,
`type=pep440,pattern={{version}},value=v1.2.3`,
`type=edge` `type=edge`
], ],
} as Inputs, } as Inputs,
@ -1373,6 +1375,262 @@ describe('tag', () => {
"org.opencontainers.image.licenses=MIT" "org.opencontainers.image.licenses=MIT"
] ]
], ],
[
'tag23',
'event_tag_v1.1.1.env',
{
images: ['org/app'],
tags: [
`type=pep440,pattern={{version}}`,
`type=pep440,pattern={{major}}.{{minor}}`,
`type=pep440,pattern={{major}}`
]
} as Inputs,
{
main: '1.1.1',
partial: ['1.1', '1'],
latest: true
} as Version,
[
'org/app:1.1.1',
'org/app:1.1',
'org/app:1',
'org/app:latest'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
],
[
'tag24',
'event_tag_1.2.env',
{
images: ['org/app'],
tags: [
`type=pep440,pattern={{version}}`,
`type=pep440,pattern={{major}}.{{minor}}`
]
} as Inputs,
{
main: '1.2',
partial: [],
latest: true
} as Version,
[
'org/app:1.2',
'org/app:latest',
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.2",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
],
[
'tag25',
'event_tag_1.1beta2.env',
{
images: ['org/app', 'ghcr.io/user/app'],
tags: [
`type=pep440,pattern={{major}}.{{minor}}`,
`type=pep440,pattern={{major}}`
]
} as Inputs,
{
main: '1.1b2',
partial: [],
latest: false
} as Version,
[
'org/app:1.1b2',
'ghcr.io/user/app:1.1b2'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1b2",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
],
[
'tag26',
'event_tag_1.0dev4.env',
{
images: ['org/app', 'ghcr.io/user/app'],
tags: [
`type=pep440,pattern={{major}}.{{minor}}`,
`type=pep440,pattern={{major}}`
]
} as Inputs,
{
main: '1.0.dev4',
partial: [],
latest: false
} as Version,
[
'org/app:1.0.dev4',
'ghcr.io/user/app:1.0.dev4'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.0.dev4",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
],
[
'tag27',
'event_tag_1.2.3rc2.env',
{
images: ['org/app', 'ghcr.io/user/app'],
tags: [
`type=pep440,pattern={{raw}}`,
`type=pep440,pattern={{version}}`,
`type=pep440,pattern={{major}}.{{minor}}`,
`type=pep440,pattern={{major}}`
]
} as Inputs,
{
main: '1.2.3rc2',
partial: [],
latest: false
} as Version,
[
'org/app:1.2.3rc2',
'ghcr.io/user/app:1.2.3rc2'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.2.3rc2",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
],
[
'tag28',
'event_tag_v1.1.1.env',
{
images: ['org/app'],
tags: [
`type=pep440,pattern={{version}}`,
`type=pep440,pattern={{major}}.{{minor}}.{{patch}}`,
`type=pep440,pattern={{major}}.{{minor}}`,
`type=pep440,pattern={{major}}`
]
} as Inputs,
{
main: '1.1.1',
partial: [
"1.1",
"1"
],
latest: true
} as Version,
[
'org/app:1.1.1',
'org/app:1.1',
'org/app:1',
'org/app:latest'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.1.1",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
],
[
'tag29',
'event_tag_1.2post1.env',
{
images: ['org/app'],
tags: [
`type=pep440,pattern={{version}}`,
`type=pep440,pattern={{major}}.{{minor}}`,
`type=pep440,pattern={{major}}`
]
} as Inputs,
{
main: '1.2.post1',
partial: [],
latest: false
} as Version,
[
'org/app:1.2.post1'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=1.2.post1",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
],
[
'tag30',
'event_tag_sometag.env',
{
images: ['ghcr.io/user/app'],
tags: [
`type=ref,event=tag`,
`type=pep440,pattern={{version}}`,
`type=pep440,pattern={{major}}.{{minor}}`,
`type=pep440,pattern={{major}}`
],
flavor: [
`latest=false`
]
} as Inputs,
{
main: 'sometag',
partial: [],
latest: false
} as Version,
[
'ghcr.io/user/app:sometag'
],
[
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=sometag",
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses=MIT"
]
],
])('given %p with %p event', tagsLabelsTest); ])('given %p with %p event', tagsLabelsTest);
}); });

3
codecov.yml Normal file
View file

@ -0,0 +1,3 @@
comment: false
github_checks:
annotations: false

10397
dist/index.js generated vendored

File diff suppressed because it is too large Load diff

View file

@ -31,6 +31,7 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.4.0", "@actions/core": "^1.4.0",
"@actions/github": "^5.0.0", "@actions/github": "^5.0.0",
"@renovate/pep440": "^1.0.0",
"csv-parse": "^4.16.0", "csv-parse": "^4.16.0",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
"moment": "^2.29.1", "moment": "^2.29.1",

View file

@ -2,6 +2,7 @@ import * as handlebars from 'handlebars';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import moment from 'moment'; import moment from 'moment';
import * as pep440 from '@renovate/pep440';
import * as semver from 'semver'; import * as semver from 'semver';
import {Inputs, tmpDir} from './context'; import {Inputs, tmpDir} from './context';
import {ReposGetResponseData} from './github'; import {ReposGetResponseData} from './github';
@ -62,6 +63,10 @@ export class Meta {
version = this.procSemver(version, tag); version = this.procSemver(version, tag);
break; break;
} }
case tcl.Type.Pep440: {
version = this.procPep440(version, tag);
break;
}
case tcl.Type.Match: { case tcl.Type.Match: {
version = this.procMatch(version, tag); version = this.procMatch(version, tag);
break; break;
@ -147,6 +152,53 @@ export class Meta {
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true'); return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true');
} }
private procPep440(version: Version, tag: tcl.Tag): Version {
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
return version;
}
let vraw: string;
if (tag.attrs['value'].length > 0) {
vraw = this.setGlobalExp(tag.attrs['value']);
} else {
vraw = this.context.ref.replace(/^refs\/tags\//g, '').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;
}
let latest: boolean = false;
const pver = pep440.explain(vraw);
if (pver.is_prerelease || pver.is_postrelease || pver.is_devrelease) {
vraw = this.setValue(pep440.clean(vraw), tag);
} else {
vraw = this.setValue(
handlebars.compile(tag.attrs['pattern'])({
raw: function () {
return vraw;
},
version: function () {
return pep440.clean(vraw);
},
major: function () {
return pep440.major(vraw);
},
minor: function () {
return pep440.minor(vraw);
},
patch: function () {
return pep440.patch(vraw);
}
}),
tag
);
latest = true;
}
return Meta.setVersion(version, vraw, this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true');
}
private procMatch(version: Version, tag: tcl.Tag): Version { private procMatch(version: Version, tag: tcl.Tag): Version {
if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) { if (!/^refs\/tags\//.test(this.context.ref) && tag.attrs['value'].length == 0) {
return version; return version;

39
src/pep440.d.ts vendored Normal file
View file

@ -0,0 +1,39 @@
interface ExplainedVersion {
epoch: number;
release: [number, number, number];
pre?: [string, number];
post?: number;
dev?: number;
local?: string;
public: string;
base_version: string;
is_prerelease: boolean;
is_devrelease: boolean;
is_postrelease: boolean;
}
interface Version {
epoch: number;
release: [number, number, number];
pre?: [string, number] | null;
post?: [string, number] | null;
dev?: [string, number] | null;
local?: Array<number> | null;
public: string;
base_version: string;
}
declare module '@renovate/pep440' {
function valid(version: string): string | null;
function clean(version: string): string;
function explain(version: string): ExplainedVersion;
function major(input: string): string;
function minor(input: string): string;
function patch(input: string): string;
function inc(input: string, release: string, preReleaseIdentifier?: string): string;
}
declare module '@renovate/pep440/lib/version' {
function stringify(parsed: Version): string;
function parse(version: string): Version;
}

View file

@ -4,6 +4,7 @@ import * as core from '@actions/core';
export enum Type { export enum Type {
Schedule = 'schedule', Schedule = 'schedule',
Semver = 'semver', Semver = 'semver',
Pep440 = 'pep440',
Match = 'match', Match = 'match',
Edge = 'edge', Edge = 'edge',
Ref = 'ref', Ref = 'ref',
@ -42,6 +43,7 @@ export class Tag {
export const DefaultPriorities: Record<Type, string> = { export const DefaultPriorities: Record<Type, string> = {
[Type.Schedule]: '1000', [Type.Schedule]: '1000',
[Type.Semver]: '900', [Type.Semver]: '900',
[Type.Pep440]: '900',
[Type.Match]: '800', [Type.Match]: '800',
[Type.Edge]: '700', [Type.Edge]: '700',
[Type.Ref]: '600', [Type.Ref]: '600',
@ -124,7 +126,8 @@ export function Parse(s: string): Tag {
} }
break; break;
} }
case Type.Semver: { case Type.Semver:
case Type.Pep440: {
if (!tag.attrs.hasOwnProperty('pattern')) { if (!tag.attrs.hasOwnProperty('pattern')) {
throw new Error(`Missing pattern attribute for ${s}`); throw new Error(`Missing pattern attribute for ${s}`);
} }

View file

@ -248,6 +248,14 @@
dependencies: dependencies:
"@babel/helper-plugin-utils" "^7.8.0" "@babel/helper-plugin-utils" "^7.8.0"
"@babel/runtime-corejs3@^7.12.1":
version "7.14.7"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.14.7.tgz#0ef292bbce40ca00f874c9724ef175a12476465c"
integrity sha512-Wvzcw4mBYbTagyBVZpAJWI06auSIj033T/yNE0Zn1xcup83MieCddZA7ls3kme17L4NOGBrQ09Q+nKB41RLWBA==
dependencies:
core-js-pure "^3.15.0"
regenerator-runtime "^0.13.4"
"@babel/template@^7.10.4", "@babel/template@^7.3.3": "@babel/template@^7.10.4", "@babel/template@^7.3.3":
version "7.10.4" version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278"
@ -602,6 +610,13 @@
dependencies: dependencies:
"@octokit/openapi-types" "^7.2.0" "@octokit/openapi-types" "^7.2.0"
"@renovate/pep440@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@renovate/pep440/-/pep440-1.0.0.tgz#9e05cac649b6a3d027cba7f2939b085de78f39ea"
integrity sha512-k3pZVxGEGpU7rpH507/9vxfFjuxX7qx4MSj9Fk+6zBsf/uZmAy8x97dNtZacbge7gP9TazbW1d7SEb5vsOmKlw==
dependencies:
xregexp "4.4.1"
"@sinonjs/commons@^1.7.0": "@sinonjs/commons@^1.7.0":
version "1.8.1" version "1.8.1"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217"
@ -1168,6 +1183,11 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
core-js-pure@^3.15.0:
version "3.15.2"
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.15.2.tgz#c8e0874822705f3385d3197af9348f7c9ae2e3ce"
integrity sha512-D42L7RYh1J2grW8ttxoY1+17Y4wXZeKe7uyplAI3FkNQyI5OgBIAjUfFiTPfL1rs0qLpxaabITNbjKl1Sp82tA==
core-util-is@1.0.2: core-util-is@1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@ -3043,6 +3063,11 @@ read-pkg@^5.2.0:
parse-json "^5.0.0" parse-json "^5.0.0"
type-fest "^0.6.0" type-fest "^0.6.0"
regenerator-runtime@^0.13.4:
version "0.13.7"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==
regex-not@^1.0.0, regex-not@^1.0.2: regex-not@^1.0.0, regex-not@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c"
@ -3851,6 +3876,13 @@ xmlchars@^2.2.0:
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
xregexp@4.4.1:
version "4.4.1"
resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.4.1.tgz#c84a88fa79e9ab18ca543959712094492185fe65"
integrity sha512-2u9HwfadaJaY9zHtRRnH6BY6CQVNQKkYm3oLtC9gJXXzfsbACg5X5e4EZZGVAH+YIfa+QA9lsFQTTe3HURF3ag==
dependencies:
"@babel/runtime-corejs3" "^7.12.1"
y18n@^4.0.0: y18n@^4.0.0:
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"