mirror of
https://github.com/docker/metadata-action.git
synced 2024-12-22 21:35:38 +00:00
Pre-release (rc, beta, alpha) will only extend {{version}} as tag for tag-semver
This commit is contained in:
parent
0dca12c226
commit
7cb65aaacb
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.8.4 (2020/11/20)
|
||||||
|
|
||||||
|
* Pre-release (rc, beta, alpha) will only extend `{{version}}` as tag for `tag-semver`
|
||||||
|
|
||||||
## 1.8.3 (2020/11/20)
|
## 1.8.3 (2020/11/20)
|
||||||
|
|
||||||
* Lowercase image name (#16)
|
* Lowercase image name (#16)
|
||||||
|
|
33
README.md
33
README.md
|
@ -26,8 +26,8 @@ ___
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
* [Notes](#notes)
|
* [Notes](#notes)
|
||||||
* [Latest tag](#latest-tag)
|
* [Latest tag](#latest-tag)
|
||||||
* [`tag-match` examples](#tag-match-examples)
|
|
||||||
* [Handle semver tag](#handle-semver-tag)
|
* [Handle semver tag](#handle-semver-tag)
|
||||||
|
* [`tag-match` examples](#tag-match-examples)
|
||||||
* [Schedule tag](#schedule-tag)
|
* [Schedule tag](#schedule-tag)
|
||||||
* [Overwrite labels](#overwrite-labels)
|
* [Overwrite labels](#overwrite-labels)
|
||||||
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
||||||
|
@ -250,6 +250,8 @@ Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
> List/CSV type can be a newline or comma delimited string
|
> List/CSV type can be a newline or comma delimited string
|
||||||
|
|
||||||
|
> `tag-semver` and `tag-match` are mutually exclusive
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
Following outputs are available
|
Following outputs are available
|
||||||
|
@ -266,18 +268,8 @@ Following outputs are available
|
||||||
|
|
||||||
Latest Docker tag will be generated by default on `push tag` event. If for example you push the `v1.2.3` Git tag,
|
Latest Docker tag will be generated by default on `push tag` event. If for example you push the `v1.2.3` Git tag,
|
||||||
you will have at the output of this action the Docker tags `v1.2.3` and `latest`. But you can allow the latest tag to be
|
you will have at the output of this action the Docker tags `v1.2.3` and `latest`. But you can allow the latest tag to be
|
||||||
generated only if the Git tag matches a regular expression with the [`tag-match` input](#tag-match-examples) or if
|
generated only if `tag-semver` is a valid [semver](https://semver.org/) or if Git tag matches a regular expression
|
||||||
`tag-semver` is valid [semver](https://semver.org/).
|
with the [`tag-match` input](#tag-match-examples).
|
||||||
|
|
||||||
### `tag-match` examples
|
|
||||||
|
|
||||||
| Git tag | `tag-match` | `tag-match-group` | Match | Output tags | Output version |
|
|
||||||
|-------------------------|------------------------------------|-------------------|----------------------|---------------------------|------------------------------|
|
|
||||||
| `v1.2.3` | `\d{1,3}.\d{1,3}.\d{1,3}` | `0` | :white_check_mark: | `1.2.3`, `latest` | `1.2.3` |
|
|
||||||
| `v2.0.8-beta.67` | `v(.*)` | `1` | :white_check_mark: | `2.0.8-beta.67`, `latest` | `2.0.8-beta.67` |
|
|
||||||
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | :white_check_mark: | `2.0`, `latest` | `2.0` |
|
|
||||||
| `release1` | `\d{1,3}.\d{1,3}` | `0` | :x: | `release1` | `release1` |
|
|
||||||
| `20200110-RC2` | `\d+` | `0` | :white_check_mark: | `20200110`, `latest` | `20200110` |
|
|
||||||
|
|
||||||
### Handle semver tag
|
### Handle semver tag
|
||||||
|
|
||||||
|
@ -293,14 +285,25 @@ If Git tag is a valid [semver](https://semver.org/) you can handle it to output
|
||||||
| `v1.2.3` | `{{minor}}` | :white_check_mark: | `2`, `latest` | `2` |
|
| `v1.2.3` | `{{minor}}` | :white_check_mark: | `2`, `latest` | `2` |
|
||||||
| `v1.2.3` | `{{patch}}` | :white_check_mark: | `3`, `latest` | `3` |
|
| `v1.2.3` | `{{patch}}` | :white_check_mark: | `3`, `latest` | `3` |
|
||||||
| `v1.2.3` | `{{major}}.{{minor}}`<br>`{{major}}.{{minor}}.{{patch}}` | :white_check_mark: | `1.2`, `1.2.3`, `latest` | `1.2`* |
|
| `v1.2.3` | `{{major}}.{{minor}}`<br>`{{major}}.{{minor}}.{{patch}}` | :white_check_mark: | `1.2`, `1.2.3`, `latest` | `1.2`* |
|
||||||
| `v2.0.8-beta.67` | `{{raw}}` | :white_check_mark: | `2.0.8-beta.67` | `2.0.8-beta.67` |
|
| `v2.0.8-beta.67` | `{{raw}}` | :white_check_mark: | `2.0.8-beta.67`** | `2.0.8-beta.67` |
|
||||||
| `v2.0.8-beta.67` | `{{version}}` | :white_check_mark: | `2.0.8-beta.67` | `2.0.8-beta.67` |
|
| `v2.0.8-beta.67` | `{{version}}` | :white_check_mark: | `2.0.8-beta.67` | `2.0.8-beta.67` |
|
||||||
| `v2.0.8-beta.67` | `{{major}}.{{minor}}` | :white_check_mark: | `2.0.8-beta.67`** | `2.0.8-beta.67` |
|
| `v2.0.8-beta.67` | `{{major}}.{{minor}}` | :white_check_mark: | `2.0.8-beta.67`** | `2.0.8-beta.67` |
|
||||||
| `release1` | `{{raw}}` | :x: | `release1` | `release1` |
|
| `release1` | `{{raw}}` | :x: | `release1` | `release1` |
|
||||||
|
|
||||||
> *First occurrence of `tag-semver` will be taken as `output.version`
|
> *First occurrence of `tag-semver` will be taken as `output.version`
|
||||||
|
|
||||||
> **Pre-release (rc, beta, alpha) will only extend `{{version}}` as tag
|
> **Pre-release (rc, beta, alpha) 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.
|
||||||
|
|
||||||
|
### `tag-match` examples
|
||||||
|
|
||||||
|
| Git tag | `tag-match` | `tag-match-group` | Match | Output tags | Output version |
|
||||||
|
|-------------------------|------------------------------------|-------------------|----------------------|---------------------------|------------------------------|
|
||||||
|
| `v1.2.3` | `\d{1,3}.\d{1,3}.\d{1,3}` | `0` | :white_check_mark: | `1.2.3`, `latest` | `1.2.3` |
|
||||||
|
| `v2.0.8-beta.67` | `v(.*)` | `1` | :white_check_mark: | `2.0.8-beta.67`, `latest` | `2.0.8-beta.67` |
|
||||||
|
| `v2.0.8-beta.67` | `v(\d.\d)` | `1` | :white_check_mark: | `2.0`, `latest` | `2.0` |
|
||||||
|
| `release1` | `\d{1,3}.\d{1,3}` | `0` | :x: | `release1` | `release1` |
|
||||||
|
| `20200110-RC2` | `\d+` | `0` | :white_check_mark: | `20200110`, `latest` | `20200110` |
|
||||||
|
|
||||||
### Schedule tag
|
### Schedule tag
|
||||||
|
|
||||||
|
|
|
@ -715,7 +715,7 @@ describe('push tag', () => {
|
||||||
'event_tag_v2.0.8-beta.67.env',
|
'event_tag_v2.0.8-beta.67.env',
|
||||||
{
|
{
|
||||||
images: ['org/app', 'ghcr.io/user/app'],
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
tagSemver: ['{{version}}', '{{major}}.{{minor}}', '{{major}}'],
|
tagSemver: ['{{major}}.{{minor}}', '{{major}}'],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: '2.0.8-beta.67',
|
main: '2.0.8-beta.67',
|
||||||
|
|
9
dist/index.js
generated
vendored
9
dist/index.js
generated
vendored
|
@ -201,9 +201,12 @@ class Meta {
|
||||||
const sver = semver.parse(version.main, {
|
const sver = semver.parse(version.main, {
|
||||||
includePrerelease: true
|
includePrerelease: true
|
||||||
});
|
});
|
||||||
version.latest = !semver.prerelease(version.main);
|
if (semver.prerelease(version.main)) {
|
||||||
version.main = handlebars.compile(this.inputs.tagSemver[0])(sver);
|
version.main = handlebars.compile('{{version}}')(sver);
|
||||||
if (version.latest) {
|
}
|
||||||
|
else {
|
||||||
|
version.latest = true;
|
||||||
|
version.main = handlebars.compile(this.inputs.tagSemver[0])(sver);
|
||||||
for (const semverTpl of this.inputs.tagSemver) {
|
for (const semverTpl of this.inputs.tagSemver) {
|
||||||
const partial = handlebars.compile(semverTpl)(sver);
|
const partial = handlebars.compile(semverTpl)(sver);
|
||||||
if (partial == version.main) {
|
if (partial == version.main) {
|
||||||
|
|
|
@ -47,9 +47,11 @@ export class Meta {
|
||||||
const sver = semver.parse(version.main, {
|
const sver = semver.parse(version.main, {
|
||||||
includePrerelease: true
|
includePrerelease: true
|
||||||
});
|
});
|
||||||
version.latest = !semver.prerelease(version.main);
|
if (semver.prerelease(version.main)) {
|
||||||
version.main = handlebars.compile(this.inputs.tagSemver[0])(sver);
|
version.main = handlebars.compile('{{version}}')(sver);
|
||||||
if (version.latest) {
|
} else {
|
||||||
|
version.latest = true;
|
||||||
|
version.main = handlebars.compile(this.inputs.tagSemver[0])(sver);
|
||||||
for (const semverTpl of this.inputs.tagSemver) {
|
for (const semverTpl of this.inputs.tagSemver) {
|
||||||
const partial = handlebars.compile(semverTpl)(sver);
|
const partial = handlebars.compile(semverTpl)(sver);
|
||||||
if (partial == version.main) {
|
if (partial == version.main) {
|
||||||
|
|
Loading…
Reference in a new issue